From b260353696149278d36ee66eb4100d13e9c81d34 Mon Sep 17 00:00:00 2001 From: Matthew Arnold Date: Tue, 17 Dec 2024 10:59:32 -0500 Subject: [PATCH] Add documentation for extra VDDK arguments. Signed-off-by: Matthew Arnold --- doc/datavolumes.md | 7 +++++++ manifests/example/vddk-args-annotation.yaml | 22 +++++++++++++++++++++ manifests/example/vddk-args-configmap.yaml | 9 +++++++++ pkg/image/nbdkit.go | 2 +- 4 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 manifests/example/vddk-args-annotation.yaml create mode 100644 manifests/example/vddk-args-configmap.yaml diff --git a/doc/datavolumes.md b/doc/datavolumes.md index f543c430e1..1b594be2be 100644 --- a/doc/datavolumes.md +++ b/doc/datavolumes.md @@ -349,6 +349,13 @@ spec: [Get VDDK ConfigMap example](../manifests/example/vddk-configmap.yaml) [Ways to find thumbprint](https://libguestfs.org/nbdkit-vddk-plugin.1.html#THUMBPRINTS) +#### Extra VDDK Configuration Options + +The VDDK library itself looks in a configuration file (such as `/etc/vmware/config`) for extra options to fine tune data transfers. To pass these options through to the VDDK, store the configuration file contents in a ConfigMap and add a `cdi.kubevirt.io/storage.pod.vddk.extraargs` annotation to the DataVolume specification. The ConfigMap will be mounted to the importer pod as a volume, and the first file in the mounted directory will be passed to the VDDK. This means that the ConfigMap must be placed in the same namespace as the DataVolume, and the ConfigMap should only have one file entry. + +[Example annotation](../manifests/example/vddk-args-annotation.yaml) +[Example ConfigMap](../manifests/example/vddk-args-configmap.yaml) + ## Multi-stage Import In a multi-stage import, multiple pods are started in succession to copy different parts of the source to an existing base disk image. Currently only the [ImageIO](#multi-stage-imageio-import) and [VDDK](#multi-stage-vddk-import) data sources support multi-stage imports. diff --git a/manifests/example/vddk-args-annotation.yaml b/manifests/example/vddk-args-annotation.yaml new file mode 100644 index 0000000000..fcada06358 --- /dev/null +++ b/manifests/example/vddk-args-annotation.yaml @@ -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" \ No newline at end of file diff --git a/manifests/example/vddk-args-configmap.yaml b/manifests/example/vddk-args-configmap.yaml new file mode 100644 index 0000000000..278918969e --- /dev/null +++ b/manifests/example/vddk-args-configmap.yaml @@ -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 \ No newline at end of file diff --git a/pkg/image/nbdkit.go b/pkg/image/nbdkit.go index 78443e6eba..d863edb54e 100644 --- a/pkg/image/nbdkit.go +++ b/pkg/image/nbdkit.go @@ -242,7 +242,7 @@ func getVddkPluginPath() NbdkitPlugin { func getVddkConfig() (string, error) { withHidden, err := os.ReadDir(common.VddkArgsDir) if err != nil { - if os.IsNotExist(err) { + if os.IsNotExist(err) { // No extra arguments ConfigMap specified, so mount directory does not exist return "", nil } return "", err