Bug 1857181

Summary: [v2v] [doc] VM import RHV to CNV targetVmName length 63 char limit
Product: Container Native Virtualization (CNV) Reporter: Amos Mastbaum <amastbau>
Component: DocumentationAssignee: Avital Pinnick <apinnick>
Status: CLOSED CURRENTRELEASE QA Contact: Amos Mastbaum <amastbau>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.4.0CC: cnv-qe-bugs, istein, ncredi
Target Milestone: ---Keywords: Reopened
Target Release: 2.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 2.4.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1857165 Environment:
Last Closed: 2020-08-10 12:51:20 UTC Type: ---
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: 1857165, 1858565    
Bug Blocks:    
Attachments:
Description Flags
edit target vm name
none
Current Documentation
none
UI Edit vm name none

Description Amos Mastbaum 2020-07-15 11:07:37 UTC
Until #1857165 is resolved*

Trying to create a vmimport with  targetVMname longer than 23 will faile the import.

To the following sections:
Importing a Red Hat Virtualization virtual machine with the CLI
Importing a Red Hat Virtualization virtual machine with the virtual machine wizard

Add a note indicating that until #1857165 is resolved, the target VM name should be 23 chars or less or the import will fail and referrer to the the Know Issues section below. 


Add the  following to the Known Issues Section:

When using a target VM Name than is longer than 23 chars, the import fail with the following error message:

"Message:               Error while importing disk image: ***
 Reason:                DataVolumeCreationFailed"

 


*after #1857165 is fixed, the targetVmName limit will be 63 char with proper validation in the CR Creation level and UI.



+++ This bug was initially created as a clone of Bug #1857165 +++

An Invalid VM target name may crash the import process: 

The importer log error suggests the requested vm name is too long, but it is less then 63 characters. 

Need to add the exact name validation rules to the documentation + some trouble shooing informaion

 

From The vmimport-controller-log:

2020-07-15T09:07:13.148564794Z {"level":"error","ts":1594804033.1481385,"logger":"controller-runtime.controller","msg":"Reconciler error","controller":"virtualmachineimport-controller","request":"amastbau-temp/s","error":"admission webhook \"virtualmachine-validator.kubevirt.io\" denied the request: must be no more than 63 <-------------------------------characters","stacktrace":"github.com/go-logr/zapr.(*zapLogger).Error\n\t/src/vm-import-operator/vendor/github.com/go-logr/zapr/zapr.go:128\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\t/src/vm-import-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:258\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\t/src/vm-import-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:232\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).worker\n\t/src/vm-import-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:211\nk8s.io/apimachinery/pkg/util/wait.JitterUntil.func1\n\t/src/vm-import-operator/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:152\nk8s.io/apimachinery/pkg/util/wait.JitterUntil\n\t/src/vm-import-operator/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:153\nk8s.io/apimachinery/pkg/util/wait.Until\n\t/src/vm-import-operator/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:88"}


 
****************************

Description of problem:

- During the import process, the CNV-VM could not have been created due to an invalid targetVM name.

- The import process continued but the DV creation failed when trying to a attach the dv to the VM which does not exist.


Version-Release number of selected component (if applicable):


How reproducible:
Always


Steps to Reproduce:
1.Using the api create vmimport with targetVmName: v2v-rhel8-vm-api-maybethistime


Actual results:

The import fails "DataVolumeCreationFailed".


Expected results:
The import process should stop with the proper error message if the vm creation fails.

Note:  
* If the VM name is not valid, it should not pass the validation stage -
we will open a separated bug for the validation issue. 
* We will open a separated documentation bug


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 Amos Mastbaum 2020-07-15 11:37:39 UTC
@Piotr Can you attach the vm validation rule the cnv vm 'v2v-rhel8-vm-api-maybethistime' breaks so we can add it to 2.4.0 documentation?

Comment 4 Amos Mastbaum 2020-07-20 08:15:22 UTC
@Avital 
1. Can you please also add to: Importing a Red Hat Virtualization virtual machine with the CLI (Step #3):
   A bullet next targetVmName, Emphasizing the targetVmName should be 23 chars or less, or the import will fail.
2. To the trouble shouting section - Error messages
   The following message may indicate the targetVmName is longer than 23 chars:    
   Message:               Error while importing disk image: ***
   Reason:                DataVolumeCreationFailed"

Comment 5 Avital Pinnick 2020-07-20 08:50:00 UTC
This is step 3: "In the Connect to Provider screen, select Red Hat Virtualization (RHV) from the Provider list."

If the source VM name is preserved during import, I think we should add a prerequisite that the RHV VM name must be less than 23 characters.

Comment 6 Avital Pinnick 2020-07-20 08:55:51 UTC
The UI does not have a field for the target VM name. How did you enter a long name?

I will add a callout note about the target name in the VirtualMachineImport CR.

Comment 8 Amos Mastbaum 2020-07-21 12:09:54 UTC
*In Trouble Shooting, the Error Message Part, The second Bullet

Please change the error message to:
denied the request: must be no more than 63 characters


*Regarding "Importing a Red Hat Virtualization virtual machine with the virtual machine wizard"
I believe Step 10 should have a bullet for the name, right before the description.

Comment 10 Ilanit Stein 2020-07-23 10:06:29 UTC
We'll focus this bug to provide instructions to user, in VM import configuration stage,
on setting VM name limited to 23 chars in GUI & CLI.


For the related error documentation, in trouble shooting section,
we already have bug 1859198.

After #1857165 (targeted to CNV-2.5) is fixed, the targetVmName limit will be 63 char with proper validation in the CR Creation level and UI.

Comment 11 Amos Mastbaum 2020-07-23 12:00:34 UTC
Created attachment 1702221 [details]
edit target vm name

Comment 12 Amos Mastbaum 2020-07-23 12:14:42 UTC
****
Re:

> I believe Step 10 should have a bullet for the name, right before the description.

What do you mean?

***There are 2 ways the target vm is available for editing:

1. The default VM name is already in use.
2. The user clicks Edit button after selecting the  source VM to import

I have attached a Screenshot , the edit button is at the bottom.

***
Re:

> denied the request: must be no more than 63 characters

Amos, that error message sounds strange. Please attach a screenshot.

**Please Remove this error completely from Error Messages

("The following error message is displayed in the VM Import Controller Pod log if the target VM name exceeds 23 characters (BZ#1857165)")

We will address this issue in 
https://bugzilla.redhat.com/show_bug.cgi?id=1859198

Comment 13 Avital Pinnick 2020-07-23 13:28:07 UTC
As far as I can tell, there is no way to enter a target VM name in the UI.

In the CLI, I have a note indicating that the name must not be more than 23 characters.

Comment 15 Amos Mastbaum 2020-07-26 10:58:00 UTC
Created attachment 1702434 [details]
Current Documentation

Comment 16 Amos Mastbaum 2020-07-26 11:03:12 UTC
" As far as I can tell, there is no way to enter a target VM name in the UI. "

Please see the attached 2 files
If user clicks edit, they can add a description, but they can also edit the name.

Comment 17 Amos Mastbaum 2020-07-26 11:04:09 UTC
Created attachment 1702435 [details]
UI Edit vm name

Comment 18 Avital Pinnick 2020-07-26 12:46:41 UTC
(In reply to Amos Mastbaum from comment #17)
> Created attachment 1702435 [details]
> UI Edit vm name

OK. When I tested the web UI for importing the RHV VM, the "General" Screen was not working. I'll add the VM name field and a note about the length.

Comment 20 Avital Pinnick 2020-08-06 14:42:41 UTC
Reopening for 2.4.1: 63 character limit for target VM name

Comment 22 Avital Pinnick 2020-08-10 12:51:20 UTC
Changes merged