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()
|
||||
|
||||
parentPool := make([]byte, 128)
|
||||
parentName := make([]byte, 128)
|
||||
parentSnapname := make([]byte, 128)
|
||||
|
||||
err = rbdImage.GetParentInfo(parentPool, parentName, parentSnapname)
|
||||
parentInfo, err := rbdImage.GetParent()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return string(parentName), nil
|
||||
return parentInfo.Image.ImageName, nil
|
||||
}
|
||||
|
||||
func (rv *rbdVolume) flatten() error {
|
||||
@ -941,22 +937,17 @@ func (rv *rbdVolume) getImageInfo() error {
|
||||
rv.imageFeatureSet = librbd.FeatureSet(features)
|
||||
|
||||
// Get parent information.
|
||||
// TODO: Replace GetParentInfo() after
|
||||
// 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)
|
||||
parentInfo, err := image.GetParent()
|
||||
if err != nil {
|
||||
// Caller should decide whether not finding
|
||||
// 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 = ""
|
||||
} else {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
rv.ParentName = string(parentName)
|
||||
rv.ParentName = parentInfo.Image.ImageName
|
||||
}
|
||||
// Get image creation time
|
||||
tm, err := image.GetCreateTimestamp()
|
||||
|
Loading…
Reference in New Issue
Block a user