cephfs: log error message if clone fails

During CreateVolume from snapshot/volume,
its difficult to identify if the clone is
failed and a new clone is created. In case
of clone failure logging the error message
for better debugging.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna 2022-01-11 12:44:22 +05:30 committed by mergify[bot]
parent d293d91c07
commit 2daf2f9f0c

View File

@ -124,6 +124,11 @@ func CheckVolExists(ctx context.Context,
return nil, cerrors.ErrClonePending return nil, cerrors.ErrClonePending
} }
if cloneState == cephFSCloneFailed { if cloneState == cephFSCloneFailed {
log.ErrorLog(ctx,
"clone failed, deleting subvolume clone. vol=%s, subvol=%s subvolgroup=%s",
volOptions.FsName,
vid.FsSubvolName,
volOptions.SubvolumeGroup)
err = volOptions.PurgeVolume(ctx, fsutil.VolumeID(vid.FsSubvolName), true) err = volOptions.PurgeVolume(ctx, fsutil.VolumeID(vid.FsSubvolName), true)
if err != nil { if err != nil {
log.ErrorLog(ctx, "failed to delete volume %s: %v", vid.FsSubvolName, err) log.ErrorLog(ctx, "failed to delete volume %s: %v", vid.FsSubvolName, err)