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>
(cherry picked from commit 9d7faf850f)
This commit is contained in:
Niels de Vos 2022-04-29 14:58:28 +02:00 committed by mergify[bot]
parent 3fcfae35a5
commit 5c0f9d565e

View File

@ -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)
} }