Bug 1925207 - VM from custom template - cloudinit disk is not added if creating the VM from custom template using customization wizard
Summary: VM from custom template - cloudinit disk is not added if creating the VM from...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Console Kubevirt Plugin
Version: 4.7
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: 4.8.0
Assignee: Matan Schatzman
QA Contact: Guohua Ouyang
URL:
Whiteboard:
: 1954851 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-02-04 15:34 UTC by Ruth Netser
Modified: 2021-07-27 22:42 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-07-27 22:41:34 UTC
Target Upstream Version:


Attachments (Terms of Use)
Screenshot (37.03 KB, image/png)
2021-02-04 15:34 UTC, Ruth Netser
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Github openshift console pull 8611 0 None Merged Bug 1925207: fix custom template cloudint disk 2021-11-22 08:56:33 UTC
Red Hat Product Errata RHSA-2021:2438 0 None None None 2021-07-27 22:42:14 UTC

Description Ruth Netser 2021-02-04 15:34:35 UTC
Created attachment 1755080 [details]
Screenshot

Description of problem:
When a VM is created using a custom template and the VM customization wizard, cloudinitdisk is not added and cloud init data is not copied to the "Cloud-init" screen of the wizard.

Version-Release number of selected component (if applicable):
OCP 4.7.0-fc.5, CNV 2.6.0

How reproducible:
100%

Steps to Reproduce:
1. Create a custom template from comon templates (linix-based)
2. Create a VM fromte custom template, use the customization flow 
- Use the customization flow to create the VM

Actual results:
"cloudinitdisk" does not exist in the "disks" windows,
cloud init data is not copied to the "Cloud-init" screen of the wizard.


Expected results:
cloudinit info should be taken from the template

Additional info:

========================= Template ===========================
kind: Template
apiVersion: template.openshift.io/v1
metadata:
  name: template-from-template
  namespace: ns-before-ug
  uid: 62cff515-0518-49ce-b2a4-d26d3bf7b0c3
  resourceVersion: '3220028'
  creationTimestamp: '2021-02-04T14:29:28Z'
  labels:
    flavor.template.kubevirt.io/small: 'true'
    os.template.kubevirt.io/fedora33: 'true'
    template.kubevirt.io/type: vm
    vm.kubevirt.io/template: fedora-server-small
    vm.kubevirt.io/template.namespace: openshift
    workload.template.kubevirt.io/server: 'true'
  annotations:
    iconClass: icon-fedora
    name.os.template.kubevirt.io/fedora33: Fedora 32 or higher
    template.kubevirt.io/provider: My company
    template.kubevirt.ui/parent-provider: Red Hat
    template.kubevirt.ui/parent-provider-url: 'https://www.fedoraproject.org'
    template.kubevirt.ui/parent-support-level: Community
  managedFields:
    - manager: Mozilla
      operation: Update
      apiVersion: template.openshift.io/v1
      time: '2021-02-04T14:29:28Z'
      fieldsType: FieldsV1
      fieldsV1:
        'f:metadata':
          'f:annotations':
            .: {}
            'f:iconClass': {}
            'f:name.os.template.kubevirt.io/fedora33': {}
            'f:template.kubevirt.io/provider': {}
            'f:template.kubevirt.ui/parent-provider': {}
            'f:template.kubevirt.ui/parent-provider-url': {}
            'f:template.kubevirt.ui/parent-support-level': {}
          'f:labels':
            .: {}
            'f:flavor.template.kubevirt.io/small': {}
            'f:os.template.kubevirt.io/fedora33': {}
            'f:template.kubevirt.io/type': {}
            'f:vm.kubevirt.io/template': {}
            'f:vm.kubevirt.io/template.namespace': {}
            'f:workload.template.kubevirt.io/server': {}
        'f:objects': {}
        'f:parameters': {}
objects:
  - apiVersion: kubevirt.io/v1alpha3
    kind: VirtualMachine
    metadata:
      annotations:
        vm.kubevirt.io/flavor: small
        vm.kubevirt.io/os: fedora
        vm.kubevirt.io/validations: |
          [
            {
              "name": "minimal-required-memory",
              "path": "jsonpath::.spec.domain.resources.requests.memory",
              "rule": "integer",
              "message": "This VM requires more memory.",
              "min": 1073741824
            }
          ]
        vm.kubevirt.io/workload: server
      labels:
        app: '${NAME}'
        vm.kubevirt.io/template: fedora-server-small
        vm.kubevirt.io/template.revision: '1'
        vm.kubevirt.io/template.version: v0.13.1
      name: '${NAME}'
    spec:
      dataVolumeTemplates:
        - metadata:
            name: '${NAME}-rootdisk'
          spec:
            pvc:
              resources:
                requests:
                  storage: 30Gi
              volumeMode: Block
              accessModes:
                - ReadWriteOnce
              storageClassName: standard
            source:
              pvc:
                name: fedora
                namespace: openshift-virtualization-os-images
      running: false
      template:
        metadata:
          labels:
            kubevirt.io/domain: '${NAME}'
            kubevirt.io/size: small
        spec:
          domain:
            cpu:
              cores: 1
              sockets: 1
              threads: 1
            devices:
              disks:
                - name: cloudinitdisk
                  disk:
                    bus: virtio
                - name: rootdisk
                  bootOrder: 1
                  disk:
                    bus: virtio
              interfaces:
                - name: nic-0
                  model: virtio
                  masquerade: {}
              networkInterfaceMultiqueue: true
              rng: {}
            machine:
              type: pc-q35-rhel8.3.0
            resources:
              requests:
                memory: 2Gi
          evictionStrategy: LiveMigrate
          networks:
            - name: nic-0
              pod: {}
          terminationGracePeriodSeconds: 180
          volumes:
            - name: cloudinitdisk
              cloudInitNoCloud:
                userData: |
                  #cloud-config
                  user: fedora
                  password: fedora
                  chpasswd:
                    expire: false
            - name: rootdisk
              dataVolume:
                name: '${NAME}-rootdisk'
          hostname: '${NAME}'
parameters:
  - name: NAME
    description: Name for the new VM
    required: true


========================= VM using custom wizard ===========================
apiVersion: kubevirt.io/v1alpha3
kind: VirtualMachine
metadata:
  annotations:
    kubevirt.io/latest-observed-api-version: v1alpha3
    kubevirt.io/storage-observed-api-version: v1alpha3
    name.os.template.kubevirt.io/fedora33: Fedora 32 or higher
    vm.kubevirt.io/flavor: small
    vm.kubevirt.io/os: fedora
    vm.kubevirt.io/validations: |
      [
        {
          "name": "minimal-required-memory",
          "path": "jsonpath::.spec.domain.resources.requests.memory",
          "rule": "integer",
          "message": "This VM requires more memory.",
          "min": 1073741824
        }
      ]
    vm.kubevirt.io/workload: server
  selfLink: >-
    /apis/kubevirt.io/v1alpha3/namespaces/ns-before-ug/virtualmachines/template-from-template-kind-grasshopper
  resourceVersion: '3221469'
  name: template-from-template-kind-grasshopper
  uid: dc5c0276-aa53-4f4b-b41b-f91e07e46b4d
  creationTimestamp: '2021-02-04T14:31:30Z'
  generation: 1
  managedFields:
    - apiVersion: kubevirt.io/v1alpha3
      fieldsType: FieldsV1
      fieldsV1:
        'f:metadata':
          'f:annotations':
            .: {}
            'f:name.os.template.kubevirt.io/fedora33': {}
            'f:vm.kubevirt.io/flavor': {}
            'f:vm.kubevirt.io/os': {}
            'f:vm.kubevirt.io/validations': {}
            'f:vm.kubevirt.io/workload': {}
          'f:labels':
            'f:vm.kubevirt.io/template.version': {}
            'f:vm.kubevirt.io/template.namespace': {}
            'f:app': {}
            .: {}
            'f:vm.kubevirt.io/template.revision': {}
            'f:workload.template.kubevirt.io/server': {}
            'f:flavor.template.kubevirt.io/small': {}
            'f:os.template.kubevirt.io/fedora33': {}
            'f:vm.kubevirt.io/template': {}
        'f:spec':
          .: {}
          'f:dataVolumeTemplates': {}
          'f:running': {}
          'f:template':
            .: {}
            'f:metadata':
              .: {}
              'f:labels':
                .: {}
                'f:flavor.template.kubevirt.io/small': {}
                'f:kubevirt.io/domain': {}
                'f:kubevirt.io/size': {}
                'f:os.template.kubevirt.io/fedora33': {}
                'f:vm.kubevirt.io/name': {}
                'f:workload.template.kubevirt.io/server': {}
            'f:spec':
              .: {}
              'f:domain':
                .: {}
                'f:cpu':
                  .: {}
                  'f:cores': {}
                  'f:sockets': {}
                  'f:threads': {}
                'f:devices':
                  .: {}
                  'f:disks': {}
                  'f:interfaces': {}
                  'f:networkInterfaceMultiqueue': {}
                  'f:rng': {}
                'f:machine':
                  .: {}
                  'f:type': {}
                'f:resources':
                  .: {}
                  'f:requests':
                    .: {}
                    'f:memory': {}
              'f:evictionStrategy': {}
              'f:hostname': {}
              'f:networks': {}
              'f:terminationGracePeriodSeconds': {}
              'f:volumes': {}
      manager: Mozilla
      operation: Update
      time: '2021-02-04T14:31:30Z'
    - apiVersion: kubevirt.io/v1alpha3
      fieldsType: FieldsV1
      fieldsV1:
        'f:metadata':
          'f:annotations':
            'f:kubevirt.io/latest-observed-api-version': {}
            'f:kubevirt.io/storage-observed-api-version': {}
        'f:status':
          .: {}
          'f:volumeSnapshotStatuses': {}
      manager: virt-controller
      operation: Update
      time: '2021-02-04T14:31:30Z'
  namespace: ns-before-ug
  labels:
    app: template-from-template-kind-grasshopper
    flavor.template.kubevirt.io/small: 'true'
    os.template.kubevirt.io/fedora33: 'true'
    vm.kubevirt.io/template: template-from-template
    vm.kubevirt.io/template.namespace: ns-before-ug
    vm.kubevirt.io/template.revision: '1'
    vm.kubevirt.io/template.version: v0.13.1
    workload.template.kubevirt.io/server: 'true'
spec:
  dataVolumeTemplates:
    - metadata:
        creationTimestamp: null
        name: template-from-template-kind-grasshopper-rootdisk-29kfr
      spec:
        pvc:
          accessModes:
            - ReadWriteOnce
          resources:
            requests:
              storage: 30Gi
          storageClassName: standard
          volumeMode: Block
        source:
          pvc:
            name: fedora
            namespace: openshift-virtualization-os-images
  running: false
  template:
    metadata:
      creationTimestamp: null
      labels:
        flavor.template.kubevirt.io/small: 'true'
        kubevirt.io/domain: template-from-template-kind-grasshopper
        kubevirt.io/size: small
        os.template.kubevirt.io/fedora33: 'true'
        vm.kubevirt.io/name: template-from-template-kind-grasshopper
        workload.template.kubevirt.io/server: 'true'
    spec:
      domain:
        cpu:
          cores: 1
          sockets: 1
          threads: 1
        devices:
          disks:
            - bootOrder: 1
              disk:
                bus: virtio
              name: rootdisk
          interfaces:
            - masquerade: {}
              model: virtio
              name: nic-0
          networkInterfaceMultiqueue: true
          rng: {}
        machine:
          type: pc-q35-rhel8.3.0
        resources:
          requests:
            memory: 2Gi
      evictionStrategy: LiveMigrate
      hostname: template-from-template-kind-grasshopper
      networks:
        - name: nic-0
          pod: {}
      terminationGracePeriodSeconds: 180
      volumes:
        - dataVolume:
            name: template-from-template-kind-grasshopper-rootdisk-29kfr
          name: rootdisk
status:
  volumeSnapshotStatuses:
    - enabled: false
      name: rootdisk
      reason: 'No Volume Snapshot Storage Class found for volume [rootdisk]'


========================= VM not using the wizard ===========================
apiVersion: kubevirt.io/v1alpha3
kind: VirtualMachine
metadata:
  annotations:
    kubevirt.io/latest-observed-api-version: v1alpha3
    kubevirt.io/storage-observed-api-version: v1alpha3
    name.os.template.kubevirt.io/fedora33: Fedora 32 or higher
    vm.kubevirt.io/flavor: small
    vm.kubevirt.io/os: fedora
    vm.kubevirt.io/validations: |
      [
        {
          "name": "minimal-required-memory",
          "path": "jsonpath::.spec.domain.resources.requests.memory",
          "rule": "integer",
          "message": "This VM requires more memory.",
          "min": 1073741824
        }
      ]
    vm.kubevirt.io/workload: server
  selfLink: >-
    /apis/kubevirt.io/v1alpha3/namespaces/ns-before-ug/virtualmachines/template-from-template-repulsive-crane
  resourceVersion: '3220334'
  name: template-from-template-repulsive-crane
  uid: 9da1d3f7-281b-4a95-ac1c-86b8d4aa7e70
  creationTimestamp: '2021-02-04T14:29:53Z'
  generation: 1
  managedFields:
    - apiVersion: kubevirt.io/v1alpha3
      fieldsType: FieldsV1
      fieldsV1:
        'f:metadata':
          'f:annotations':
            .: {}
            'f:name.os.template.kubevirt.io/fedora33': {}
            'f:vm.kubevirt.io/flavor': {}
            'f:vm.kubevirt.io/os': {}
            'f:vm.kubevirt.io/validations': {}
            'f:vm.kubevirt.io/workload': {}
          'f:labels':
            'f:vm.kubevirt.io/template.version': {}
            'f:vm.kubevirt.io/template.namespace': {}
            'f:app': {}
            .: {}
            'f:vm.kubevirt.io/template.revision': {}
            'f:workload.template.kubevirt.io/server': {}
            'f:flavor.template.kubevirt.io/small': {}
            'f:os.template.kubevirt.io/fedora33': {}
            'f:vm.kubevirt.io/template': {}
        'f:spec':
          .: {}
          'f:dataVolumeTemplates': {}
          'f:running': {}
          'f:template':
            .: {}
            'f:metadata':
              .: {}
              'f:labels':
                .: {}
                'f:flavor.template.kubevirt.io/small': {}
                'f:kubevirt.io/domain': {}
                'f:kubevirt.io/size': {}
                'f:os.template.kubevirt.io/fedora33': {}
                'f:vm.kubevirt.io/name': {}
                'f:workload.template.kubevirt.io/server': {}
            'f:spec':
              .: {}
              'f:domain':
                .: {}
                'f:cpu':
                  .: {}
                  'f:cores': {}
                  'f:sockets': {}
                  'f:threads': {}
                'f:devices':
                  .: {}
                  'f:disks': {}
                  'f:interfaces': {}
                  'f:networkInterfaceMultiqueue': {}
                  'f:rng': {}
                'f:machine':
                  .: {}
                  'f:type': {}
                'f:resources':
                  .: {}
                  'f:requests':
                    .: {}
                    'f:memory': {}
              'f:evictionStrategy': {}
              'f:hostname': {}
              'f:networks': {}
              'f:terminationGracePeriodSeconds': {}
              'f:volumes': {}
      manager: Mozilla
      operation: Update
      time: '2021-02-04T14:29:53Z'
    - apiVersion: kubevirt.io/v1alpha3
      fieldsType: FieldsV1
      fieldsV1:
        'f:metadata':
          'f:annotations':
            'f:kubevirt.io/latest-observed-api-version': {}
            'f:kubevirt.io/storage-observed-api-version': {}
        'f:status':
          .: {}
          'f:volumeSnapshotStatuses': {}
      manager: virt-controller
      operation: Update
      time: '2021-02-04T14:29:53Z'
  namespace: ns-before-ug
  labels:
    app: template-from-template-repulsive-crane
    flavor.template.kubevirt.io/small: 'true'
    os.template.kubevirt.io/fedora33: 'true'
    vm.kubevirt.io/template: template-from-template
    vm.kubevirt.io/template.namespace: ns-before-ug
    vm.kubevirt.io/template.revision: '1'
    vm.kubevirt.io/template.version: v0.13.1
    workload.template.kubevirt.io/server: 'true'
spec:
  dataVolumeTemplates:
    - metadata:
        creationTimestamp: null
        name: template-from-template-repulsive-crane-rootdisk
      spec:
        pvc:
          accessModes:
            - ReadWriteOnce
          resources:
            requests:
              storage: 30Gi
          storageClassName: standard
          volumeMode: Block
        source:
          pvc:
            name: fedora
            namespace: openshift-virtualization-os-images
  running: false
  template:
    metadata:
      creationTimestamp: null
      labels:
        flavor.template.kubevirt.io/small: 'true'
        kubevirt.io/domain: template-from-template-repulsive-crane
        kubevirt.io/size: small
        os.template.kubevirt.io/fedora33: 'true'
        vm.kubevirt.io/name: template-from-template-repulsive-crane
        workload.template.kubevirt.io/server: 'true'
    spec:
      domain:
        cpu:
          cores: 1
          sockets: 1
          threads: 1
        devices:
          disks:
            - disk:
                bus: virtio
              name: cloudinitdisk
            - bootOrder: 1
              disk:
                bus: virtio
              name: rootdisk
          interfaces:
            - masquerade: {}
              model: virtio
              name: nic-0
          networkInterfaceMultiqueue: true
          rng: {}
        machine:
          type: pc-q35-rhel8.3.0
        resources:
          requests:
            memory: 2Gi
      evictionStrategy: LiveMigrate
      hostname: template-from-template-repulsive-crane
      networks:
        - name: nic-0
          pod: {}
      terminationGracePeriodSeconds: 180
      volumes:
        - cloudInitNoCloud:
            userData: |
              #cloud-config
              user: fedora
              password: fedora
              chpasswd:
                expire: false
          name: cloudinitdisk
        - dataVolume:
            name: template-from-template-repulsive-crane-rootdisk
          name: rootdisk
status:
  volumeSnapshotStatuses:
    - enabled: false
      name: cloudinitdisk
      reason: Volume type does not suport snapshots
    - enabled: false
      name: rootdisk
      reason: 'No Volume Snapshot Storage Class found for volume [rootdisk]'

Comment 1 Guohua Ouyang 2021-03-03 09:34:03 UTC
Could reproduce the issue on OCP 4.7.0, cloud-init is empty in advance window when create customize VM from customize template.

Comment 3 Guohua Ouyang 2021-04-13 02:08:56 UTC
verified on master

Comment 4 Yaacov Zamir 2021-05-19 16:36:13 UTC
*** Bug 1954851 has been marked as a duplicate of this bug. ***

Comment 7 errata-xmlrpc 2021-07-27 22:41:34 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 Container Platform 4.8.2 bug fix and security 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-2021:2438


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