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:
Madhu Rajanna
2020-07-06 11:52:34 +05:30
committed by mergify[bot]
parent 341a3c9f59
commit 9bb79fbe7d
5 changed files with 14 additions and 22 deletions

View File

@ -945,23 +945,9 @@ func (cs *ControllerServer) DeleteSnapshot(ctx context.Context, req *csi.DeleteS
return nil, status.Error(codes.Internal, err.Error())
}
} else {
// save image ID
var j = &journal.Connection{}
j, err = snapJournal.Connect(rbdSnap.Monitors, cr)
if err != nil {
klog.Errorf(util.Log(ctx, "failed to connect to cluster: %v"), err)
return nil, status.Error(codes.Internal, err.Error())
}
defer j.Destroy()
// TODO replace GetStoredImageID with GetImageAttributes in all places
rbdVol.ImageID, err = j.GetStoredImageID(ctx, rbdSnap.JournalPool, rbdSnap.ReservedID, cr)
if err != nil {
klog.Errorf(util.Log(ctx, "failed to get reserved image id: %v"), err)
return nil, status.Error(codes.Internal, err.Error())
}
rbdVol.ImageID = rbdSnap.ImageID
// update parent name to delete the snapshot
rbdSnap.RbdImageName = rbdVol.RbdImageName
err = cleanUpSnapshot(ctx, rbdVol, rbdSnap, rbdVol, cr)
if err != nil {
klog.Errorf(util.Log(ctx, "failed to delete image: %v"), err)