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:
Niels de Vos 2022-04-29 14:58:28 +02:00 committed by mergify[bot]
parent 188e560ee9
commit 9d7faf850f

View File

@ -18,6 +18,7 @@ package controller
import (
"context"
"strings"
"github.com/ceph/ceph-csi/internal/cephfs"
"github.com/ceph/ceph-csi/internal/cephfs/store"
@ -140,8 +141,8 @@ func (cs *Server) DeleteVolume(
defer nfsVolume.Destroy()
err = nfsVolume.DeleteExport()
// TODO: if the export does not exist, but the backend does, delete the backend
if err != nil {
// if the export does not exist, continue with deleting the backend volume
if err != nil && !strings.Contains(err.Error(), "Export does not exist") {
return nil, status.Errorf(codes.InvalidArgument, "failed to delete export: %v", err)
}