-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[release-v1.58] CNV-52722: Pass through extra VDDK configuration opti…
…ons to importer pod. (#3610) * CNV-52722: Pass through extra VDDK configuration options to importer pod. (#3572) * Add annotation for extra VDDK library arguments. The VDDK library itself accepts infrequently-used arguments in a configuration file, and some of these arguments have been tested to show a significant transfer speedup in some environments. This adds an annotation that references a ConfigMap holding the contents of this VDDK configuration file, and mounts it to the importer pod. The first file in the mounted directory is passed to the VDDK. Signed-off-by: Matthew Arnold <[email protected]> * Add functional test for VDDK args annotation. Signed-off-by: Matthew Arnold <[email protected]> * Add unit test for extra VDDK arguments annotation. Signed-off-by: Matthew Arnold <[email protected]> * Add documentation for extra VDDK arguments. Signed-off-by: Matthew Arnold <[email protected]> * Simplify new functional test annotation creation. Signed-off-by: Matthew Arnold <[email protected]> * Look for specific file instead of first file. Instead of listing the mounted VDDK arguments directory and filtering out hidden files, just hard-code the expected file name and ConfigMap key. Signed-off-by: Matthew Arnold <[email protected]> * Move extra VDDK arguments functional test. Put this in import_test and assert the values there, instead of in the VDDK test plugin. The VDDK plugin logs the given values, and then the test scans the log for what it expects to see. Signed-off-by: Matthew Arnold <[email protected]> * Clean up lint error. Signed-off-by: Matthew Arnold <[email protected]> * Move VDDK configuration test back, change test ID. Signed-off-by: Matthew Arnold <[email protected]> * Avoid using kubectl for scanning nbdkit logs. Signed-off-by: Matthew Arnold <[email protected]> * Temporary: show whole nbdkit log after failure. Signed-off-by: Matthew Arnold <[email protected]> * Revert "Temporary: show whole nbdkit log after failure." This reverts commit 488849f. Signed-off-by: Matthew Arnold <[email protected]> * Copy extra VDDK args annotation for populators. Also add a related unit test. Signed-off-by: Matthew Arnold <[email protected]> * Correct VDDK args config map mount comment. Signed-off-by: Matthew Arnold <[email protected]> --------- Signed-off-by: Matthew Arnold <[email protected]> * Patch merge conflict in test, "core" vs. "v1". Signed-off-by: Matthew Arnold <[email protected]> * Correct merge conflict in extra args volume mount. Signed-off-by: Matthew Arnold <[email protected]> --------- Signed-off-by: Matthew Arnold <[email protected]>
- Loading branch information
Showing
12 changed files
with
262 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
apiVersion: cdi.kubevirt.io/v1beta1 | ||
kind: DataVolume | ||
metadata: | ||
name: "vddk-dv" | ||
namespace: "cdi" | ||
annotations: | ||
cdi.kubevirt.io/storage.pod.vddk.extraargs: vddk-arguments | ||
spec: | ||
source: | ||
vddk: | ||
backingFile: "[iSCSI_Datastore] vm/vm_1.vmdk" # From 'Hard disk'/'Disk File' in vCenter/ESX VM settings | ||
url: "https://vcenter.corp.com" | ||
uuid: "52260566-b032-36cb-55b1-79bf29e30490" | ||
thumbprint: "20:6C:8A:5D:44:40:B3:79:4B:28:EA:76:13:60:90:6E:49:D9:D9:A3" # SSL fingerprint of vCenter/ESX host | ||
secretRef: "vddk-credentials" | ||
initImageURL: "registry:5000/vddk-init:latest" | ||
storage: | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: "32Gi" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
namespace: cdi | ||
name: vddk-arguments | ||
data: | ||
vddk-config-file: -| | ||
VixDiskLib.nfcAio.Session.BufSizeIn64KB=16 | ||
VixDiskLib.nfcAio.Session.BufCount=4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3367,6 +3367,69 @@ var _ = Describe("[vendor:[email protected]][level:component]DataVolume tests", | |
}), | ||
) | ||
}) | ||
|
||
Describe("extra configuration options for VDDK imports", func() { | ||
It("[test_id:XXXX]succeed importing VDDK data volume with extra arguments ConfigMap set", Label("VDDK"), func() { | ||
vddkConfigOptions := []string{ | ||
"VixDiskLib.nfcAio.Session.BufSizeIn64KB=16", | ||
"vixDiskLib.nfcAio.Session.BufCount=4", | ||
} | ||
|
||
vddkConfigMap := &v1.ConfigMap{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: "vddk-extras", | ||
}, | ||
Data: map[string]string{ | ||
common.VddkArgsKeyName: strings.Join(vddkConfigOptions, "\n"), | ||
}, | ||
} | ||
|
||
_, err := f.K8sClient.CoreV1().ConfigMaps(f.Namespace.Name).Create(context.TODO(), vddkConfigMap, metav1.CreateOptions{}) | ||
if !k8serrors.IsAlreadyExists(err) { | ||
Expect(err).ToNot(HaveOccurred()) | ||
} | ||
|
||
vcenterURL := fmt.Sprintf(utils.VcenterURL, f.CdiInstallNs) | ||
dataVolume := createVddkDataVolume("import-pod-vddk-config-test", "100Mi", vcenterURL) | ||
|
||
By(fmt.Sprintf("Create new DataVolume %s", dataVolume.Name)) | ||
controller.AddAnnotation(dataVolume, controller.AnnPodRetainAfterCompletion, "true") | ||
controller.AddAnnotation(dataVolume, controller.AnnVddkExtraArgs, "vddk-extras") | ||
dataVolume, err = utils.CreateDataVolumeFromDefinition(f.CdiClient, f.Namespace.Name, dataVolume) | ||
Expect(err).ToNot(HaveOccurred()) | ||
|
||
By("Verify PVC was created") | ||
pvc, err := utils.WaitForPVC(f.K8sClient, dataVolume.Namespace, dataVolume.Name) | ||
Expect(err).ToNot(HaveOccurred()) | ||
f.ForceBindIfWaitForFirstConsumer(pvc) | ||
|
||
By("Wait for import to be completed") | ||
err = utils.WaitForDataVolumePhase(f, dataVolume.Namespace, cdiv1.Succeeded, dataVolume.Name) | ||
Expect(err).ToNot(HaveOccurred(), "DataVolume not in phase succeeded in time") | ||
|
||
By("Find importer pods after completion") | ||
pvcName := dataVolume.Name | ||
// When using populators, the PVC Prime name is used to build the importer pod | ||
if usePopulator, _ := dvc.CheckPVCUsingPopulators(pvc); usePopulator { | ||
pvcName = populators.PVCPrimeName(pvc) | ||
} | ||
By("Find importer pod " + pvcName) | ||
importer, err := utils.FindPodByPrefixOnce(f.K8sClient, dataVolume.Namespace, common.ImporterPodName, common.CDILabelSelector) | ||
Expect(err).ToNot(HaveOccurred()) | ||
Expect(importer.DeletionTimestamp).To(BeNil()) | ||
|
||
Eventually(func() (string, error) { | ||
out, err := f.K8sClient.CoreV1(). | ||
Pods(importer.Namespace). | ||
GetLogs(importer.Name, &v1.PodLogOptions{SinceTime: &metav1.Time{Time: CurrentSpecReport().StartTime}}). | ||
DoRaw(context.Background()) | ||
return string(out), err | ||
}, time.Minute, pollingInterval).Should(And( | ||
ContainSubstring(vddkConfigOptions[0]), | ||
ContainSubstring(vddkConfigOptions[1]), | ||
)) | ||
}) | ||
}) | ||
}) | ||
|
||
func SetFilesystemOverhead(f *framework.Framework, globalOverhead, scOverhead string) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters