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>
This commit is contained in:
Niels de Vos 2022-04-15 10:31:07 +02:00 committed by mergify[bot]
parent 8655a55b2e
commit 2b71aac752

View File

@ -18,7 +18,6 @@ package controller
import ( import (
"context" "context"
"fmt"
"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"
@ -75,7 +74,7 @@ func (cs *Server) CreateVolume(
req *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error) { req *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error) {
res, err := cs.backendServer.CreateVolume(ctx, req) res, err := cs.backendServer.CreateVolume(ctx, req)
if err != nil { if err != nil {
return res, fmt.Errorf("failed to create CephFS volume: %w", err) return nil, err
} }
backend := res.Volume backend := res.Volume