Created attachment 1819605 [details] vmio controller log Created attachment 1819605 [details] vmio controller log Description of problem: Import a source VM with 63 char long name and More Than 1 Disk causes the VMIO import to fail: DataVolumeCreationFailed: Error while importing disk image: . admission webhook "virtualmachine-validator.kubevirt.io" denied the request: spec.template.spec.domain.devices.disks[1] and spec.template.spec.domain.devices.disks[0] must not have the same Name., spec.template.spec.volumes[1] and spec.template.spec.volumes[0] must not have the same Name. Version-Release number of selected component (if applicable): How reproducible: 100% Steps to Reproduce: 1. Import Any VM with at least 2 disks and a 63 char long name 2. 3. Actual results: Expected results: Additional info: vmio cr: http://pastebin.test.redhat.com/990953 VMIO controller log attached Note: RHV (vmware not tested yet).
The flow in the bug description PASS for VMware-6.5. When using a short VM name, this bug doesn't occur.
I think the problem comes from https://github.com/kubevirt/vm-import-operator/blob/master/pkg/providers/ovirt/mapper/mapper.go#L199. The volume names are shortened to 63 characters to respect the RFC 1123 Label Names specification [1]. The problem is that the base name before shortening is "dv-<DataVolume.name>". And the DataVolume.name is "<VM.name>-<DiskAttachment.Id>". When there is only one disk, the DataVolume.name is still unique, since the VM.name is unique. But with 2 disks, the shortened name is identical for the 2 disks. This leads the admission controller to reject the VirtualMachine. [1] https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-label-names
Please verify with hco-registry-bundle-container-v4.8.2-15 / iib:106992.
verfifed CNV-v4.8.2-18
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (Moderate: OpenShift Virtualization 4.8.2 Images security and bug fix update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2021:3598