Created attachment 1701187 [details] vmimport-controller-log Created attachment 1701187 [details] vmimport-controller-log Created attachment 1701187 [details] vmimport-controller-log Description of problem: Import Process fail if targetVmName is longer than 23 chars. Version-Release number of selected component (if applicable): How reproducible: Always Steps to Reproduce: 1.Using the api/ui create vmimport with targetVmName longer than 23 chars (vm12312345678902234567890) Actual results: The import fails "DataVolumeCreationFailed". ***See Jakub Dzon comment: Logs indicates a failed DV creation/attachment did not fail the import and should. Expected results: An Invalid name Additional info: vmimport-controller log attached ***vmimport: Name: s Namespace: amastbau-temp Labels: <none> Annotations: vmimport.v2v.kubevirt.io/progress: 100 vmimport.v2v.kubevirt.io/source-vm-initial-state: down API Version: v2v.kubevirt.io/v1alpha1 Kind: VirtualMachineImport Metadata: Creation Timestamp: 2020-07-15T09:06:20Z Generation: 1 Managed Fields: API Version: v2v.kubevirt.io/v1alpha1 Fields Type: FieldsV1 fieldsV1: f:spec: .: f:providerCredentialsSecret: .: f:name: f:source: .: f:ovirt: .: f:mappings: .: f:networkMappings: f:vm: .: f:id: f:startVm: f:targetVmName: Manager: oc Operation: Update Time: 2020-07-15T09:06:20Z API Version: v2v.kubevirt.io/v1alpha1 Fields Type: FieldsV1 fieldsV1: f:metadata: f:annotations: .: f:vmimport.v2v.kubevirt.io/progress: f:vmimport.v2v.kubevirt.io/source-vm-initial-state: f:status: .: f:conditions: f:dataVolumes: f:targetVmName: Manager: vm-import-controller Operation: Update Time: 2020-07-15T09:15:42Z Resource Version: 3719450 Self Link: /apis/v2v.kubevirt.io/v1alpha1/namespaces/amastbau-temp/virtualmachineimports/s UID: 2a41be32-62e5-4cd9-b64e-76c752e1da59 Spec: Provider Credentials Secret: Name: my-secret-with-ovirt-credentials-red Source: Ovirt: Mappings: Network Mappings: Source: Name: ovirtmgmt/ovirtmgmt Target: Name: pod Type: pod Vm: Id: cd67cfea-e2e0-4e58-95e5-dd532c1d1d81 Start Vm: false Target Vm Name: v2v-rhel8-vm-api-maybethistime Status: Conditions: Last Heartbeat Time: 2020-07-15T09:06:51Z Last Transition Time: 2020-07-15T09:06:51Z Message: Validation completed successfully Reason: ValidationCompleted Status: True Type: Valid Last Heartbeat Time: 2020-07-15T09:06:51Z Last Transition Time: 2020-07-15T09:06:51Z Message: VM specifies IO Threads: 0, VM has NUMA tune mode secified: interleave, Interface 338dc670-47b9-4792-8134-f88746058a47 uses profile with a network filter with ID: d2370ab4-fee3-11e9-a310-8c1645ce738e. Reason: MappingRulesVerificationReportedWarnings Status: True Type: MappingRulesVerified Last Heartbeat Time: 2020-07-15T09:15:42Z Last Transition Time: 2020-07-15T09:15:42Z Message: Error while importing disk image: v2v-rhel8-vm-api-maybethistime-8db337e7-bbdf-40ff-b45a-b285b37e0d80 Reason: ProcessingFailed Status: False Type: Processing Last Heartbeat Time: 2020-07-15T09:15:42Z Last Transition Time: 2020-07-15T09:15:42Z Message: Error while importing disk image: v2v-rhel8-vm-api-maybethistime-8db337e7-bbdf-40ff-b45a-b285b37e0d80 Reason: DataVolumeCreationFailed Status: False Type: Succeeded Data Volumes: Name: v2v-rhel8-vm-api-maybethistime-8db337e7-bbdf-40ff-b45a-b285b37e0d80 Target Vm Name: v2v-rhel8-vm-api-maybethistime Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal ImportScheduled 35m virtualmachineimport-controller Import of Virtual Machine amastbau-temp/v2v-rhel8-vm-api-maybethistime started Normal ImportInProgress 34m virtualmachineimport-controller Import of Virtual Machine amastbau-temp/v2v-rhel8-vm-api-maybethistime disk v2v-rhel8-vm-api-maybethistime-8db337e7-bbdf-40ff-b45a-b285b37e0d80 in progress
I think you can solve this at the v2v level by deleting the DV once you know the VM import cannot complete successfully. Deleting the DV will cause the importer Pod to be deleted along with the underlying PVC.
Closer examination of the issue in functional tests environment has shown that the VM is created with given name (shorter than 63 characters) but it is not possible to attach disks to it - the admission hook rejects disks and volumes with names longer than 63 characters (the generated name is in following format: dv-<vm name>-<disk attachment id>). The solution to that is to limit the length of the disk+volume names to 63 characters. The errors reporting that the VM cannot be found are result of the VM being already gone after we remove it after failed import. Additional issue arises when the target VM name is longer than 63 characters - we try to put the name in at least one label ("app" on VirtualMachine) and it fails, because label value cannot be longer than 63 characters. The solution to that problem is to limit the length of the target vm name to 63 characters (as opposed to current 253).
Code for release 2.4.1 is under review in PR https://github.com/kubevirt/vm-import-operator/pull/348 Changes for 2.5 were merged from https://github.com/kubevirt/vm-import-operator/pull/341.
Changes were merged to https://github.com/kubevirt/vm-import-operator/tree/release-0.1
Please add fixed in version
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 (OpenShift Virtualization 2.4.1 images), 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/RHBA-2020:3629