mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-22 04:50:23 +00:00
cephfs: handle cephfs clone limit error
This is to pre-emptively add check for EAGAIN error returned from ceph as part of https://github.com/ceph/ceph/pull/52670 if all the clone threads are busy and return csi compatible error. Fixes: #3996 Signed-off-by: karthik-us <ksubrahm@redhat.com>
This commit is contained in:
parent
878eef803e
commit
f6665294a1
@ -20,6 +20,7 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"syscall"
|
||||
|
||||
"github.com/ceph/ceph-csi/internal/cephfs/core"
|
||||
cerrors "github.com/ceph/ceph-csi/internal/cephfs/errors"
|
||||
@ -134,6 +135,11 @@ func (cs *ControllerServer) createBackingVolumeFromSnapshotSource(
|
||||
})
|
||||
if err != nil {
|
||||
log.ErrorLog(ctx, "failed to create clone from snapshot %s: %v", sID.FsSnapshotName, err)
|
||||
// TODO: Add error handle for EAGAIN in go-ceph and replace the
|
||||
// syscall.EAGAIN check with the go-ceph compatible error.
|
||||
if errors.Is(err, syscall.EAGAIN) {
|
||||
return status.Error(codes.ResourceExhausted, err.Error())
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
@ -156,6 +162,11 @@ func (cs *ControllerServer) createBackingVolumeFromVolumeSource(
|
||||
|
||||
if err := volClient.CreateCloneFromSubvolume(ctx, &parentVolOpt.SubVolume); err != nil {
|
||||
log.ErrorLog(ctx, "failed to create clone from subvolume %s: %v", fsutil.VolumeID(pvID.FsSubvolName), err)
|
||||
// TODO: Add error handle for EAGAIN in go-ceph and replace the
|
||||
// syscall.EAGAIN check with the go-ceph compatible error.
|
||||
if errors.Is(err, syscall.EAGAIN) {
|
||||
return status.Error(codes.ResourceExhausted, err.Error())
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user