mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-21 22:00:19 +00:00
cephfs: delete subvolume if SetAllMetadata fails
To avoid subvolume leaks if the SetAllMetadata operations fails delete the subvolume. If any operation fails after creating the subvolume we will remove the omap as the omap gets removed we will need to remove the subvolume to avoid stale resources. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
parent
e08005f402
commit
302fead713
@ -409,6 +409,11 @@ func (cs *ControllerServer) CreateVolume(
|
||||
// Set Metadata on PV Create
|
||||
err = volClient.SetAllMetadata(metadata)
|
||||
if err != nil {
|
||||
purgeErr := volClient.PurgeVolume(ctx, true)
|
||||
if purgeErr != nil {
|
||||
log.ErrorLog(ctx, "failed to delete volume %s: %v", vID.FsSubvolName, purgeErr)
|
||||
}
|
||||
|
||||
return nil, status.Error(codes.Internal, err.Error())
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user