diff --git a/pkg/driver/node.go b/pkg/driver/node.go index ef7ae326d..e73534cc5 100644 --- a/pkg/driver/node.go +++ b/pkg/driver/node.go @@ -207,7 +207,7 @@ func (d *NodeService) NodeStageVolume(ctx context.Context, req *csi.NodeStageVol source, err := d.mounter.FindDevicePath(devicePath, volumeID, partition, d.metadata.GetRegion()) if err != nil { - return nil, status.Errorf(codes.NotFound, "Failed to find device path %s. %v", devicePath, err) + return nil, status.Errorf(codes.Internal, "Failed to find device path %s. %v", devicePath, err) } klog.V(4).InfoS("NodeStageVolume: find device path", "devicePath", devicePath, "source", source) @@ -394,7 +394,7 @@ func (d *NodeService) NodeExpandVolume(ctx context.Context, req *csi.NodeExpandV devicePath, err := d.mounter.FindDevicePath(deviceName, volumeID, "", d.metadata.GetRegion()) if err != nil { - return nil, status.Errorf(codes.NotFound, "failed to find device path for device name %s for mount %s: %v", deviceName, req.GetVolumePath(), err) + return nil, status.Errorf(codes.Internal, "failed to find device path for device name %s for mount %s: %v", deviceName, req.GetVolumePath(), err) } // TODO: lock per volume ID to have some idempotency @@ -625,7 +625,7 @@ func (d *NodeService) nodePublishVolumeForBlock(req *csi.NodePublishVolumeReques source, err := d.mounter.FindDevicePath(devicePath, volumeID, partition, d.metadata.GetRegion()) if err != nil { - return status.Errorf(codes.NotFound, "Failed to find device path %s. %v", devicePath, err) + return status.Errorf(codes.Internal, "Failed to find device path %s. %v", devicePath, err) } klog.V(4).InfoS("NodePublishVolume [block]: find device path", "devicePath", devicePath, "source", source) diff --git a/pkg/driver/node_test.go b/pkg/driver/node_test.go index 3d15923bb..59f6ebab2 100644 --- a/pkg/driver/node_test.go +++ b/pkg/driver/node_test.go @@ -642,7 +642,7 @@ func TestNodeStageVolume(t *testing.T) { m.EXPECT().GetRegion().Return("us-west-2") return m }, - expectedErr: status.Errorf(codes.NotFound, "Failed to find device path %s. %v", "/dev/xvdba", errors.New("find device path error")), + expectedErr: status.Errorf(codes.Internal, "Failed to find device path %s. %v", "/dev/xvdba", errors.New("find device path error")), }, { name: "path_exists_error", @@ -1743,7 +1743,7 @@ func TestNodePublishVolume(t *testing.T) { m.EXPECT().GetRegion().Return("us-west-2") return m }, - expectedErr: status.Error(codes.NotFound, "Failed to find device path /dev/xvdba. device path error"), + expectedErr: status.Error(codes.Internal, "Failed to find device path /dev/xvdba. device path error"), }, } for _, tc := range testCases { @@ -2271,7 +2271,7 @@ func TestNodeExpandVolume(t *testing.T) { return m }, expectedResp: nil, - expectedErr: status.Error(codes.NotFound, "failed to find device path for device name device-name for mount /volume/path: failed to find device path"), + expectedErr: status.Error(codes.Internal, "failed to find device path for device name device-name for mount /volume/path: failed to find device path"), }, { name: "resize_error",