Bug 1885196 - VM creation fails when using URL as boot source or when cloning a golden image
Summary: VM creation fails when using URL as boot source or when cloning a golden image
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Container Native Virtualization (CNV)
Classification: Red Hat
Component: Virtualization
Version: 2.5.0
Hardware: Unspecified
OS: Unspecified
urgent
urgent
Target Milestone: ---
: 2.5.0
Assignee: sgott
QA Contact: Kedar Bidarkar
URL:
Whiteboard:
: 1886927 (view as bug list)
Depends On:
Blocks: 1881928
TreeView+ depends on / blocked
 
Reported: 2020-10-05 12:02 UTC by Ruth Netser
Modified: 2020-11-17 13:25 UTC (History)
10 users (show)

Fixed In Version: hco-bundle-registry-container-v2.5.0-315 virt-operator-container-v2.5.0-78
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-11-17 13:24:56 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
review_and_confirm_details (128.57 KB, image/png)
2020-10-12 20:05 UTC, Kedar Bidarkar
no flags Details
successfully created virtual machine (129.78 KB, image/png)
2020-10-12 20:07 UTC, Kedar Bidarkar
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Github kubevirt kubevirt pull 4319 0 None closed restore backwards compatiblity with api group/version on DataVolumeTemplates spec 2020-11-01 20:59:38 UTC
Red Hat Product Errata RHEA-2020:5127 0 None None None 2020-11-17 13:25:33 UTC

Description Ruth Netser 2020-10-05 12:02:28 UTC
Description of problem:
When creating a VM using the wizard and selecting "URL" as boot source, VM creation fails on:
"spec.dataVolumeTemplates.apiVersion in body is a forbidden property" for field "undefined".

Version-Release number of selected component (if applicable):
OCP 4.6.0-fc.9, CNV 2.5.0

How reproducible:
100%

Steps to Reproduce:
1. From the UI, select to create a VM from Wizard
2. Select "URL (adds disk) from "Boot Source" dropdown menu
3. Create the VM

Actual results:
VM creation fails on
Error "spec.dataVolumeTemplates.apiVersion in body is a forbidden property" for field "undefined".


Expected results:
VM creation should succeed

Additional info:
VM yaml generated by the UI:

apiVersion: kubevirt.io/v1alpha3
kind: VirtualMachine
metadata:
  labels:
    app: rhel
    vm.kubevirt.io/template: rhel8-desktop-small-v0.11.3
    vm.kubevirt.io/template.revision: '1'
    vm.kubevirt.io/template.version: v0.12.2
    os.template.kubevirt.io/rhel8.3: 'true'
    flavor.template.kubevirt.io/small: 'true'
    workload.template.kubevirt.io/desktop: 'true'
    vm.kubevirt.io/template.namespace: openshift
  name: rhel
  namespace: default
  annotations:
    name.os.template.kubevirt.io/rhel8.3: Red Hat Enterprise Linux 8.0 or higher
spec:
  dataVolumeTemplates:
    - apiVersion: cdi.kubevirt.io/v1alpha1
      kind: DataVolume
      metadata:
        name: rhel-rootdisk-3g30k
      spec:
        pvc:
          accessModes:
            - ReadWriteOnce
          resources:
            requests:
              storage: 15Gi
          volumeMode: Filesystem
        source:
          http:
            url: >-
              http://x.x.x.x/files/cnv-tests/rhel-images/rhel-82.qcow2
  running: false
  template:
    metadata:
      labels:
        kubevirt.io/domain: rhel
        kubevirt.io/size: small
        vm.kubevirt.io/name: rhel
        os.template.kubevirt.io/rhel8.3: 'true'
        flavor.template.kubevirt.io/small: 'true'
        workload.template.kubevirt.io/desktop: 'true'
    spec:
      domain:
        cpu:
          cores: 1
          sockets: 1
          threads: 1
        devices:
          disks:
            - disk:
                bus: virtio
              name: cloudinitdisk
            - bootOrder: 1
              disk:
                bus: virtio
              name: rootdisk
          inputs:
            - bus: virtio
              name: tablet
              type: tablet
          interfaces:
            - masquerade: {}
              model: virtio
              name: nic-0
          networkInterfaceMultiqueue: true
          rng: {}
        machine:
          type: pc-q35-rhel8.2.0
        resources:
          requests:
            memory: 2Gi
      evictionStrategy: LiveMigrate
      hostname: rhel
      networks:
        - name: nic-0
          pod: {}
      terminationGracePeriodSeconds: 180
      volumes:
        - cloudInitNoCloud:
            userData: |
              #cloud-config
              user: cloud-user
              password: i01v-t3si-rox9
              chpasswd:
                expire: false
          name: cloudinitdisk
        - dataVolume:
            name: rhel-rootdisk-3g30k
          name: rootdisk

Comment 1 Ruth Netser 2020-10-05 13:30:48 UTC
VMs, cloned from golden images (which also use dataVolumeTemplates) also fail creation.

Comment 2 Ruth Netser 2020-10-05 13:32:48 UTC
VM from golden images:

apiVersion: kubevirt.io/v1alpha3
kind: VirtualMachine
metadata:
  labels:
    app: eeeee
    vm.kubevirt.io/template: rhel8-desktop-tiny-v0.11.3
    vm.kubevirt.io/template.revision: '1'
    vm.kubevirt.io/template.version: v0.12.2
    os.template.kubevirt.io/rhel8.3: 'true'
    flavor.template.kubevirt.io/tiny: 'true'
    workload.template.kubevirt.io/desktop: 'true'
    vm.kubevirt.io/template.namespace: openshift
  name: eeeee
  namespace: openshift-virtualization-os-images
  annotations:
    name.os.template.kubevirt.io/rhel8.3: Red Hat Enterprise Linux 8.0 or higher
spec:
  dataVolumeTemplates:
    - apiVersion: cdi.kubevirt.io/v1alpha1
      kind: DataVolume
      metadata:
        name: eeeee-rootdisk-cj2nh
      spec:
        pvc:
          accessModes:
            - ReadWriteOnce
          resources:
            requests:
              storage: 20Gi
          volumeMode: Filesystem
        source:
          pvc:
            name: rhel8
            namespace: openshift-virtualization-os-images
  running: false
  template:
    metadata:
      labels:
        kubevirt.io/domain: eeeee
        kubevirt.io/size: tiny
        vm.kubevirt.io/name: eeeee
        os.template.kubevirt.io/rhel8.3: 'true'
        flavor.template.kubevirt.io/tiny: 'true'
        workload.template.kubevirt.io/desktop: 'true'
    spec:
      domain:
        cpu:
          cores: 1
          sockets: 1
          threads: 1
        devices:
          disks:
            - disk:
                bus: virtio
              name: cloudinitdisk
            - bootOrder: 1
              disk:
                bus: virtio
              name: rootdisk
          inputs:
            - bus: virtio
              name: tablet
              type: tablet
          interfaces:
            - masquerade: {}
              model: virtio
              name: nic-0
          networkInterfaceMultiqueue: true
          rng: {}
        machine:
          type: pc-q35-rhel8.2.0
        resources:
          requests:
            memory: 1.5Gi
      evictionStrategy: LiveMigrate
      hostname: eeeee
      networks:
        - name: nic-0
          pod: {}
      terminationGracePeriodSeconds: 180
      volumes:
        - cloudInitNoCloud:
            userData: |
              #cloud-config
              user: cloud-user
              password: gbjz-9420-yqkb
              chpasswd:
                expire: false
          name: cloudinitdisk
        - dataVolume:
            name: eeeee-rootdisk-cj2nh
          name: rootdisk

Comment 3 Tomas Jelinek 2020-10-05 13:45:49 UTC
This regression has been caused by https://github.com/kubevirt/kubevirt/pull/4261

I understand it was an API clean-up and we were not supposed to be using it, it was part of the api nonetheless and we were using it. Now we have passed code freeze and we can not do this cleanup on the UI side easily (maybe we could get an exception but I would love to avoid risking regressions by doing this type of changes now). I would say the https://github.com/kubevirt/kubevirt/pull/4261 should be reverted and re-introduced for 2.6 so we can properly adapt in 4.7.

Comment 5 David Vossel 2020-10-05 14:35:17 UTC
>  I understand it was an API clean-up and we were not supposed to be using it, it was part of the api nonetheless and we were using it. Now we have passed code freeze and we can not do this cleanup on the UI side easily (maybe we could get an exception but I would love to avoid risking regressions by doing this type of changes now). I would say the https://github.com/kubevirt/kubevirt/pull/4261 should be reverted and re-introduced for 2.6 so we can properly adapt in 4.7.

here's the background. The DataVolumeTemplates section exposed two structs that should never have been captured by our api to begin with, the api group/version and status structs. If a user attempts to set either of these structs, they do nothing. They are essentially no-ops, which means we're exposing parts of our API that we don't actually support. That's what PR 4261 addressed by removing the unused fields.

That PR obvious causes issues, beyond the one that's captured in this BZ even. We already had to re-introduce a dummy status struct to maintain compatibility. We can do the same with the api group/version. We'll just need to clearly state that the DataVolumeTemplate group/version fields are no-ops that exist to maintain compatibility. 

So I wouldn't revert pr4261, instead i'd add the group/version field back. There are still changes with pr 4261 around how dataVolume status is documented/supported that we'd like to keep.

Comment 7 David Vossel 2020-10-05 14:55:20 UTC
https://github.com/kubevirt/kubevirt/pull/4319

Comment 8 Tomas Jelinek 2020-10-05 15:28:27 UTC
(In reply to David Vossel from comment #7)
> https://github.com/kubevirt/kubevirt/pull/4319

Thank you!
I have opened a followup (https://bugzilla.redhat.com/show_bug.cgi?id=1885319) to remove the use of it from the ui code.

Comment 9 Tomas Jelinek 2020-10-11 12:08:35 UTC
*** Bug 1886927 has been marked as a duplicate of this bug. ***

Comment 10 Kedar Bidarkar 2020-10-12 20:05:47 UTC
Created attachment 1721038 [details]
review_and_confirm_details

Comment 11 Kedar Bidarkar 2020-10-12 20:07:30 UTC
Created attachment 1721039 [details]
successfully created virtual machine

Comment 14 errata-xmlrpc 2020-11-17 13:24:56 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.5.0 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/RHEA-2020:5127


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