mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 10:53:34 +00:00
journal: replace getStoredImageId with go-ceph
moved implementation of getStoredImageID to go-ceph to get better performance. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
341a3c9f59
commit
9bb79fbe7d
@ -133,6 +133,7 @@ func checkSnapCloneExists(ctx context.Context, parentVol *rbdVolume, rbdSnap *rb
|
||||
}
|
||||
snapUUID := snapData.ImageUUID
|
||||
rbdSnap.RbdSnapName = snapData.ImageAttributes.ImageName
|
||||
rbdSnap.ImageID = snapData.ImageAttributes.ImageID
|
||||
|
||||
// it should never happen that this disagrees, but check
|
||||
if rbdSnap.Pool != snapData.ImagePool {
|
||||
@ -193,8 +194,7 @@ func checkSnapCloneExists(ctx context.Context, parentVol *rbdVolume, rbdSnap *rb
|
||||
return false, err
|
||||
}
|
||||
|
||||
vol.ImageID, err = j.GetStoredImageID(ctx, vol.JournalPool, vol.ReservedID, cr)
|
||||
if _, ok := err.(util.ErrKeyNotFound); ok {
|
||||
if vol.ImageID == "" {
|
||||
sErr := vol.getImageID()
|
||||
if sErr != nil {
|
||||
klog.Errorf(util.Log(ctx, "failed to get image id %s: %v"), vol, sErr)
|
||||
@ -254,7 +254,7 @@ func (rv *rbdVolume) Exists(ctx context.Context) (bool, error) {
|
||||
|
||||
rv.ReservedID = imageData.ImageUUID
|
||||
rv.RbdImageName = imageData.ImageAttributes.ImageName
|
||||
|
||||
rv.ImageID = imageData.ImageAttributes.ImageID
|
||||
// check if topology constraints match what is found
|
||||
rv.Topology, err = util.MatchTopologyForPool(rv.TopologyPools, rv.TopologyRequirement,
|
||||
imageData.ImagePool)
|
||||
@ -282,8 +282,7 @@ func (rv *rbdVolume) Exists(ctx context.Context) (bool, error) {
|
||||
return false, err
|
||||
}
|
||||
|
||||
rv.ImageID, err = j.GetStoredImageID(ctx, rv.JournalPool, rv.ReservedID, rv.conn.Creds)
|
||||
if _, ok := err.(util.ErrKeyNotFound); ok {
|
||||
if rv.ImageID == "" {
|
||||
err = rv.getImageID()
|
||||
if err != nil {
|
||||
klog.Errorf(util.Log(ctx, "failed to get image id %s: %v"), rv, err)
|
||||
|
Reference in New Issue
Block a user