From 273c28313088b73fe164bf1f7ac6396cfa39bb9f Mon Sep 17 00:00:00 2001 From: Grant Griffiths Date: Thu, 29 Aug 2019 08:51:56 -0700 Subject: [PATCH] Fix to add PVC Metadata to VolumeLabels (#1208) Signed-off-by: Grant Griffiths --- csi/controller.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/csi/controller.go b/csi/controller.go index 1f9700df6..da258c91c 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