mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-09 16:00:22 +00:00
nfs: delete the CephFS volume when the export is already removed
In case the NFS-export has already been removed from the NFS-server, but the CSI Controller was restarted, a retry to remove the NFS-volume will fail with an error like: > GRPC error: ....: response status not empty: "Export does not exist" When this error is reported, assume the NFS-export was already removed from the NFS-server configuration, and continue with deleting the backend volume. Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
parent
188e560ee9
commit
9d7faf850f
@ -18,6 +18,7 @@ package controller
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/ceph/ceph-csi/internal/cephfs"
|
"github.com/ceph/ceph-csi/internal/cephfs"
|
||||||
"github.com/ceph/ceph-csi/internal/cephfs/store"
|
"github.com/ceph/ceph-csi/internal/cephfs/store"
|
||||||
@ -140,8 +141,8 @@ func (cs *Server) DeleteVolume(
|
|||||||
defer nfsVolume.Destroy()
|
defer nfsVolume.Destroy()
|
||||||
|
|
||||||
err = nfsVolume.DeleteExport()
|
err = nfsVolume.DeleteExport()
|
||||||
// TODO: if the export does not exist, but the backend does, delete the backend
|
// if the export does not exist, continue with deleting the backend volume
|
||||||
if err != nil {
|
if err != nil && !strings.Contains(err.Error(), "Export does not exist") {
|
||||||
return nil, status.Errorf(codes.InvalidArgument, "failed to delete export: %v", err)
|
return nil, status.Errorf(codes.InvalidArgument, "failed to delete export: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user