mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-22 14:20:19 +00:00
rbd: replace go-ceph GetParentInfo() with GetParent()
GetParent() is a newer and better version of GetParentInfo() in go-ceph. Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
This commit is contained in:
parent
eefaf09ade
commit
0ecfd0e72c
@ -517,15 +517,11 @@ func (rv *rbdVolume) getParentName() (string, error) {
|
|||||||
}
|
}
|
||||||
defer rbdImage.Close()
|
defer rbdImage.Close()
|
||||||
|
|
||||||
parentPool := make([]byte, 128)
|
parentInfo, err := rbdImage.GetParent()
|
||||||
parentName := make([]byte, 128)
|
|
||||||
parentSnapname := make([]byte, 128)
|
|
||||||
|
|
||||||
err = rbdImage.GetParentInfo(parentPool, parentName, parentSnapname)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
return string(parentName), nil
|
return parentInfo.Image.ImageName, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rv *rbdVolume) flatten() error {
|
func (rv *rbdVolume) flatten() error {
|
||||||
@ -941,22 +937,17 @@ func (rv *rbdVolume) getImageInfo() error {
|
|||||||
rv.imageFeatureSet = librbd.FeatureSet(features)
|
rv.imageFeatureSet = librbd.FeatureSet(features)
|
||||||
|
|
||||||
// Get parent information.
|
// Get parent information.
|
||||||
// TODO: Replace GetParentInfo() after
|
parentInfo, err := image.GetParent()
|
||||||
// https://github.com/ceph/go-ceph/issues/347 is fixed.
|
|
||||||
parentPool := make([]byte, 128)
|
|
||||||
parentName := make([]byte, 128)
|
|
||||||
parentSnapname := make([]byte, 128)
|
|
||||||
err = image.GetParentInfo(parentPool, parentName, parentSnapname)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Caller should decide whether not finding
|
// Caller should decide whether not finding
|
||||||
// the parent is an error or not.
|
// the parent is an error or not.
|
||||||
if strings.Contains(err.Error(), "No such file or directory") {
|
if errors.Is(err, librbd.ErrNotFound) {
|
||||||
rv.ParentName = ""
|
rv.ParentName = ""
|
||||||
} else {
|
} else {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rv.ParentName = string(parentName)
|
rv.ParentName = parentInfo.Image.ImageName
|
||||||
}
|
}
|
||||||
// Get image creation time
|
// Get image creation time
|
||||||
tm, err := image.GetCreateTimestamp()
|
tm, err := image.GetCreateTimestamp()
|
||||||
|
Loading…
Reference in New Issue
Block a user