From 2bf17007d9e3de3b2577f8b8359b47551e52c955 Mon Sep 17 00:00:00 2001 From: Yug Gupta Date: Wed, 27 Oct 2021 13:55:23 +0530 Subject: [PATCH] e2e: validate pvc-pvc clone in ec pool Validate pvc to pvc clone in erasure coded pools. Signed-off-by: Yug Gupta --- e2e/rbd.go | 53 +++++++++++++++++++++++++++++++++++++++++++++++++--- e2e/utils.go | 6 +++++- 2 files changed, 55 insertions(+), 4 deletions(-) diff --git a/e2e/rbd.go b/e2e/rbd.go index 3c703c00e..31e68f95b 100644 --- a/e2e/rbd.go +++ b/e2e/rbd.go @@ -515,6 +515,27 @@ var _ = Describe("RBD", func() { f) }) + By("create an erasure coded PVC and validate PVC-PVC clone", func() { + validatePVCClone( + defaultCloneCount, + pvcPath, + appPath, + pvcSmartClonePath, + appSmartClonePath, + erasureCodedPool, + noKMS, + noPVCValidation, + f) + err := deleteResource(rbdExamplePath + "storageclass.yaml") + if err != nil { + e2elog.Failf("failed to delete storageclass: %v", err) + } + err = createRBDStorageClass(f.ClientSet, f, defaultSCName, nil, nil, deletePolicy) + if err != nil { + e2elog.Failf("failed to create storageclass: %v", err) + } + }) + By("create a PVC and bind it to an app with ext4 as the FS ", func() { err := deleteResource(rbdExamplePath + "storageclass.yaml") if err != nil { @@ -1536,6 +1557,7 @@ var _ = Describe("RBD", func() { appPath, pvcSmartClonePath, appSmartClonePath, + noDataPool, noKMS, noPVCValidation, f) @@ -1553,7 +1575,15 @@ var _ = Describe("RBD", func() { e2elog.Failf("failed to create storageclass: %v", err) } - validatePVCClone(1, pvcPath, appPath, pvcSmartClonePath, appSmartClonePath, noKMS, isThickPVC, f) + validatePVCClone(1, + pvcPath, + appPath, + pvcSmartClonePath, + appSmartClonePath, + noDataPool, + noKMS, + isThickPVC, + f) err = deleteResource(rbdExamplePath + "storageclass.yaml") if err != nil { @@ -1732,7 +1762,15 @@ var _ = Describe("RBD", func() { e2elog.Failf("failed to create storageclass: %v", err) } - validatePVCClone(1, pvcPath, appPath, pvcSmartClonePath, appSmartClonePath, secretsMetadataKMS, isEncryptedPVC, f) + validatePVCClone(1, + pvcPath, + appPath, + pvcSmartClonePath, + appSmartClonePath, + noDataPool, + secretsMetadataKMS, + isEncryptedPVC, + f) err = deleteResource(rbdExamplePath + "storageclass.yaml") if err != nil { @@ -1758,7 +1796,15 @@ var _ = Describe("RBD", func() { e2elog.Failf("failed to create storageclass: %v", err) } - validatePVCClone(1, pvcPath, appPath, pvcSmartClonePath, appSmartClonePath, vaultKMS, isEncryptedPVC, f) + validatePVCClone(1, + pvcPath, + appPath, + pvcSmartClonePath, + appSmartClonePath, + noDataPool, + vaultKMS, + isEncryptedPVC, + f) err = deleteResource(rbdExamplePath + "storageclass.yaml") if err != nil { @@ -1787,6 +1833,7 @@ var _ = Describe("RBD", func() { rawAppPath, pvcBlockSmartClonePath, appBlockSmartClonePath, + noDataPool, noKMS, noPVCValidation, f) diff --git a/e2e/utils.go b/e2e/utils.go index ff295f044..2c6b3ece9 100644 --- a/e2e/utils.go +++ b/e2e/utils.go @@ -594,7 +594,8 @@ func writeDataAndCalChecksum(app *v1.Pod, opt *metav1.ListOptions, f *framework. // nolint:gocyclo,gocognit,nestif,cyclop // reduce complexity func validatePVCClone( totalCount int, - sourcePvcPath, sourceAppPath, clonePvcPath, clonePvcAppPath string, + sourcePvcPath, sourceAppPath, clonePvcPath, clonePvcAppPath, + dataPool string, kms kmsConfig, validatePVC validateFunc, f *framework.Framework) { @@ -662,6 +663,9 @@ func validatePVCClone( LabelSelector: fmt.Sprintf("%s=%s", appKey, label[appKey]), } wgErrs[n] = createPVCAndApp(name, f, &p, &a, deployTimeout) + if wgErrs[n] == nil && dataPool != noDataPool { + wgErrs[n] = checkPVCDataPoolForImageInPool(f, &p, defaultRBDPool, dataPool) + } if wgErrs[n] == nil && kms != noKMS { if kms.canGetPassphrase() { imageData, sErr := getImageInfoFromPVC(p.Namespace, name, f)