diff --git a/csi/controller.go b/csi/controller.go index 1f9700df6..d1042c221 100644 --- a/csi/controller.go +++ b/csi/controller.go @@ -334,9 +334,12 @@ func (s *OsdCsiServer) CreateVolume( // Get PVC Metadata and add to locator.VolumeLabels pvcMetadata, err := getPVCMetadata(req.GetParameters()) if err != nil { - for k, v := range pvcMetadata { - locator.VolumeLabels[k] = v - } + return nil, status.Errorf( + codes.Internal, + "Unable to get PVC Metadata: %v", err) + } + for k, v := range pvcMetadata { + locator.VolumeLabels[k] = v } // Get parent ID from request: snapshot or volume @@ -650,4 +653,4 @@ func (s *OsdCsiServer) ListSnapshots( // The function ListSnapshots is also not published as // supported by this implementation return nil, status.Error(codes.Unimplemented, "ListSnapshots is not implemented") -} +