Bug 2000021

Summary: [VMIO][RHV VM Import] 63 long char VM Name with more than 1 Disk results in DataVolumeCreationFailed
Product: Container Native Virtualization (CNV) Reporter: Amos Mastbaum <amastbau>
Component: V2VAssignee: Sam Lucidi <slucidi>
Status: CLOSED ERRATA QA Contact: Daniel Gur <dagur>
Severity: high Docs Contact:
Priority: medium    
Version: 4.8.5CC: cnv-qe-bugs, fdupont, istein
Target Milestone: ---   
Target Release: 4.8.2   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2000409 (view as bug list) Environment:
Last Closed: 2021-09-21 11:08:02 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2000409    
Attachments:
Description Flags
vmio controller log none

Description Amos Mastbaum 2021-09-01 08:24:54 UTC
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).

Comment 2 Ilanit Stein 2021-09-01 16:39:42 UTC
The flow in the bug description PASS for VMware-6.5.

When using a short VM name, this bug doesn't occur.

Comment 3 Fabien Dupont 2021-09-01 20:26:27 UTC
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

Comment 5 Fabien Dupont 2021-09-07 20:27:47 UTC
Please verify with hco-registry-bundle-container-v4.8.2-15 / iib:106992.

Comment 6 Amos Mastbaum 2021-09-09 15:26:22 UTC
verfifed CNV-v4.8.2-18

Comment 11 errata-xmlrpc 2021-09-21 11:08:02 UTC
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