mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-05-24 08:16:42 +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> (cherry picked from commit 302fead71368c51a6327f4353a330e4de5ee8c26)
This commit is contained in:
parent
763aa3df03
commit
d39b61334a
@ -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…
x
Reference in New Issue
Block a user