Bug 1857165 - [v2v] VM import RHV to CNV Import fails if targetVmName is longer than 23 chars
Summary: [v2v] VM import RHV to CNV Import fails if targetVmName is longer than 23 c...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Container Native Virtualization (CNV)
Classification: Red Hat
Component: V2V
Version: 2.4.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 2.4.1
Assignee: Jakub Dzon
QA Contact: Amos Mastbaum
URL:
Whiteboard:
Depends On:
Blocks: 1857181 1858565
TreeView+ depends on / blocked
 
Reported: 2020-07-15 10:15 UTC by Amos Mastbaum
Modified: 2020-09-03 20:31 UTC (History)
8 users (show)

Fixed In Version: v2.4.1-2
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1857181 1858565 (view as bug list)
Environment:
Last Closed: 2020-09-03 20:31:08 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
vmimport-controller-log (13.26 KB, application/gzip)
2020-07-15 10:15 UTC, Amos Mastbaum
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Github kubevirt vm-import-operator pull 348 0 None closed Target VM name length limit et. al. backport to 0.1.x line 2020-11-01 10:50:07 UTC
Red Hat Product Errata RHBA-2020:3629 0 None None None 2020-09-03 20:31:20 UTC

Description Amos Mastbaum 2020-07-15 10:15:40 UTC
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

Comment 1 Adam Litke 2020-07-15 15:13:27 UTC
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.

Comment 2 Jakub Dzon 2020-07-15 15:37:44 UTC
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).

Comment 3 Jakub Dzon 2020-07-21 18:18:02 UTC
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.

Comment 4 Jakub Dzon 2020-07-22 13:54:10 UTC
Changes were merged to https://github.com/kubevirt/vm-import-operator/tree/release-0.1

Comment 5 Nelly Credi 2020-08-10 08:08:02 UTC
Please add fixed in version

Comment 10 errata-xmlrpc 2020-09-03 20:31:08 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 (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


Note You need to log in before you can comment on or make changes to this bug.