Uploaded image for project: 'OpenShift Virtualization'
  1. OpenShift Virtualization
  2. CNV-27451

[2181992] The console goes blank after trying to clone a virtual machinec -clone backport

XMLWordPrintable

    • High
    • None

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

      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:

      ~~~

      1. 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:

      — Additional comment from Guohua Ouyang on 2023-03-22 12:56:10 UTC —

      — Additional comment from Guohua Ouyang on 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.

      — Additional comment from errata-xmlrpc on 2023-03-23 05:33:17 UTC —

      This bug has been added to advisory RHEA-2022:101182 by CPaaS, owned by Greg Allen (contra-dev/pipeline@REDHAT.COM)

              tnisan@redhat.com Tal Nisan
              mschatzm@redhat.com Matan Schatzman
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: