mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
rbd: check rbd image status only duing DeleteVolume RPC
currently, various calls to deleteImage does not need the rbdStatus check. That is only required when calling from DeleteVolume. This PR optimizes the rbd image deletion by removing the status check. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
44d79e3bda
commit
7a87db39e6
@ -547,6 +547,16 @@ func (cs *ControllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVol
|
||||
}
|
||||
defer cs.VolumeLocks.Release(rbdVol.RequestName)
|
||||
|
||||
found, _, err := rbdStatus(ctx, rbdVol, cr)
|
||||
if err != nil {
|
||||
klog.Errorf(util.Log(ctx, "failed getting information for image (%s): (%s)"), rbdVol, err)
|
||||
return nil, status.Error(codes.Internal, err.Error())
|
||||
}
|
||||
if found {
|
||||
klog.Errorf(util.Log(ctx, "rbd %s is still being used"), rbdVol)
|
||||
return nil, status.Errorf(codes.Internal, "rbd %s is still being used", rbdVol.RbdImageName)
|
||||
}
|
||||
|
||||
// Deleting rbd image
|
||||
klog.V(4).Infof(util.Log(ctx, "deleting image %s"), rbdVol.RbdImageName)
|
||||
if err = deleteImage(ctx, rbdVol, cr); err != nil {
|
||||
|
Reference in New Issue
Block a user