Skip to content

Commit c85ac0e

Browse files
committed
e2e: account for custom volumeNamePrefix in getImageInfoFromPVC
Signed-off-by: Rakshith R <rar@redhat.com>
1 parent e5a0bf6 commit c85ac0e

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

e2e/rbd_helper.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,16 @@ func getImageInfoFromPVC(pvcNamespace, pvcName string, f *framework.Framework) (
284284
imageIDRegex := regexp.MustCompile(`(\w+\-?){5}$`)
285285
imageID := imageIDRegex.FindString(pv.Spec.CSI.VolumeHandle)
286286

287+
prefix := "csi-vol-"
288+
if pv.Spec.CSI.VolumeAttributes != nil {
289+
if val, ok := pv.Spec.CSI.VolumeAttributes["volumeNamePrefix"]; ok {
290+
prefix = val
291+
}
292+
}
293+
287294
imageData = imageInfoFromPVC{
288295
imageID: imageID,
289-
imageName: "csi-vol-" + imageID,
296+
imageName: prefix + imageID,
290297
csiVolumeHandle: pv.Spec.CSI.VolumeHandle,
291298
pvName: pv.Name,
292299
}

0 commit comments

Comments
 (0)