nfs: return gRPC status from CephFS CreateVolume failure

The NFS Controller returns a non-gRPC error in case the CreateVolume
call for the CephFS volume fails. It is better to return the gRPC-error
that the CephFS Controller passed along.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
(cherry picked from commit 2b71aac752)
This commit is contained in:
Niels de Vos 2022-04-15 10:31:07 +02:00 committed by mergify[bot]
parent 6e0e6df2db
commit 61ca06148e

View File

@ -18,7 +18,6 @@ package controller
import (
"context"
"fmt"
"github.com/ceph/ceph-csi/internal/cephfs"
"github.com/ceph/ceph-csi/internal/cephfs/store"
@ -75,7 +74,7 @@ func (cs *Server) CreateVolume(
req *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error) {
res, err := cs.backendServer.CreateVolume(ctx, req)
if err != nil {
return res, fmt.Errorf("failed to create CephFS volume: %w", err)
return nil, err
}
backend := res.Volume