Bug 2180853

Summary: The console goes blank after trying to clone a virtual machine
Product: Container Native Virtualization (CNV) Reporter: nijin ashok <nashok>
Component: User ExperienceAssignee: Matan Schatzman <mschatzm>
Status: CLOSED ERRATA QA Contact: Guohua Ouyang <gouyang>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.12.0CC: gouyang, mschatzm
Target Milestone: ---   
Target Release: 4.13.0   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2181042 2181992 (view as bug list) Environment:
Last Closed: 2023-05-18 02:58:32 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: 2181042, 2181992    

Description nijin ashok 2023-03-22 12:20:07 UTC
Description of problem:

If the spec/template/metadata/label is not defined in a VM definition and if we try to clone this virtual machine, the console goes blank white with the below error in the browser console:

~~~
vendors~main-chunk-c0c15fae48996264a3e4.min.js:172232 TypeError: Cannot set properties of undefined (setting 'vm.kubevirt.io/name')
    at CloneVMModal.tsx:76:68
    at helpers.tsx:77:5
    at produce (immer.esm.mjs:1:16170)
    at produceCleanClonedVM (helpers.tsx:55:17)
    at CloneVMModal.tsx:63:42
    at Object.useMemo (vendors~main-chunk-c0c15fae48996264a3e4.min.js:172232:1)
    at t.useMemo (vendors~main-chunk-c0c15fae48996264a3e4.min.js:172199:1)
    at CloneVMModal (CloneVMModal.tsx:62:32)
    at na (vendors~main-chunk-c0c15fae48996264a3e4.min.js:172232:1)
    at Hs (vendors~main-chunk-c0c15fae48996264a3e4.min.js:172232:1)
~~~

The issue is VM definition doesn't have the field spec.template.metadata.labels.

~~~
oc get vm formtv -o yaml|yq '.spec.template.metadata'
{
  "creationTimestamp": null
}
~~~

The workaround is to add the label:

~~~
# oc patch vm formtv   --type=merge  -p '{"spec":{"template":{"metadata":{"labels":{"kubevirt.io/domains":"formtv"}}}}}'
~~~

Note that the issue is affecting all the VMs migrated from MTV using both RHV and VMware provider since it creates VMs without labels. So the workaround may not be feasible for all customers. 
 
 
Version-Release number of selected component (if applicable):

OpenShift Virtualization   4.12.0

How reproducible:

100%

Steps to Reproduce:

1. Migrate a VM using MTV from RHV/VMware to OpenShift Virtualization (or just create a VM without spec.template.metadata.labels).

2. Try cloning this VM from UI:

Virtual machines => Actions => Clone
 
3. The UI goes blank white screen.

Actual results:

The console goes blank after trying to clone a virtual machine

Expected results:

Cloning should work.

Additional info:

Comment 1 Guohua Ouyang 2023-03-22 12:56:10 UTC
*** Bug 2180683 has been marked as a duplicate of this bug. ***

Comment 2 Guohua Ouyang 2023-03-23 00:28:53 UTC
Verified on v4.13.0-2248, clone a VM which has no kubevirt.io/domains in spec.template.metadata.labels is okay.

Comment 4 errata-xmlrpc 2023-05-18 02:58:32 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.13.0 Images security, bug fix, and enhancement 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-2023:3205