mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
cephfs: report detailed error message on clone failure
go-ceph provides a new GetFailure() method to retrieve details errors when cloning failed. This is now included in the `cephFSCloneState` struct, which was a simple string before. While modifying the `cephFSCloneState` struct, the constants have been removed, as go-ceph provides them as well. Fixes: #3140 Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
5c40f1ef33
commit
a1ed6207f6
@ -119,15 +119,17 @@ func CheckVolExists(ctx context.Context,
|
||||
|
||||
return nil, err
|
||||
}
|
||||
if cloneState == core.CephFSCloneInprogress {
|
||||
return nil, cerrors.ErrCloneInProgress
|
||||
err = cloneState.ToError()
|
||||
if errors.Is(err, cerrors.ErrCloneInProgress) {
|
||||
return nil, err
|
||||
}
|
||||
if cloneState == core.CephFSClonePending {
|
||||
return nil, cerrors.ErrClonePending
|
||||
if errors.Is(err, cerrors.ErrClonePending) {
|
||||
return nil, err
|
||||
}
|
||||
if cloneState == core.CephFSCloneFailed {
|
||||
if errors.Is(err, cerrors.ErrCloneFailed) {
|
||||
log.ErrorLog(ctx,
|
||||
"clone failed, deleting subvolume clone. vol=%s, subvol=%s subvolgroup=%s",
|
||||
"clone failed (%v), deleting subvolume clone. vol=%s, subvol=%s subvolgroup=%s",
|
||||
err,
|
||||
volOptions.FsName,
|
||||
vid.FsSubvolName,
|
||||
volOptions.SubvolumeGroup)
|
||||
@ -149,8 +151,8 @@ func CheckVolExists(ctx context.Context,
|
||||
|
||||
return nil, err
|
||||
}
|
||||
if cloneState != core.CephFSCloneComplete {
|
||||
return nil, fmt.Errorf("clone is not in complete state for %s", vid.FsSubvolName)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("clone is not in complete state for %s: %w", vid.FsSubvolName, err)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user