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

Configuring Disk of Template via Console results in shared disk for all VMs from that template

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical Critical
    • CNV v4.16.0
    • CNV v4.15.2
    • CNV User Interface
    • None
    • 0.42
    • False
    • Hide

      None

      Show
      None
    • False
    • CNV v4.16.0.rhel9-2649
    • ---
    • ---
    • Medium
    • No

      1. Go to Virtualization
      2. Go to Templates
      3. Find rhel9-server-small
      4. Clone it to a new template, i.e. rhel9-server-small-test
      5. In the new template, go to Disks
      6. Add a new disk (i.e. blank PVC)

      The new Disk added via UI generated this DV in DataVolumeTemplates. Look at the name:

              - metadata:
                  name: disk-tan-aardvark-13-clg7hj      <---- this is a static name
                spec:
                  storage:
                    resources:
                      requests:
                        storage: 30Gi
                    storageClassName: hostpath-csi-nvme
                  preallocation: false
                  source:
                    blank: {}

      7. Now create 2-3 VMs based on this template. In my case the VMs are:

       $ oc get vm | grep rhel9
      rhel9-1        91s   Running    True
      rhel9-2        70s   Starting   False
      rhel9-3        48s   Starting   False

      8. Now check the DVs, all 3 VMs have their own DV for the root disk, but there is only one DV for the disk added at step 6.

      $ oc get dv
      NAME                          PHASE       PROGRESS   RESTARTS   AGE
      disk-tan-aardvark-13-clg7hj   Succeeded   100.0%                117s
      rhel9-1                       Succeeded   100.0%                117s
      rhel9-2                       Succeeded   100.0%                97s
      rhel9-3                       Succeeded   100.0%                75s

      9. The DV name generated at step 6 does not have the VM {NAME} prefix on it, and therefore the same DV is re-used for every VM cloned from the template, as the DV already exists, they all use the same PVC, skipping provisioning new ones.

      The UI should generate a name based on the VM name, like the original template has for the original VM root disk

            dataVolumeTemplates:
              - apiVersion: cdi.kubevirt.io/v1beta1
                kind: DataVolume
                metadata:
                  name: '${NAME}'   <----

      10. This causes all the VMs to share that 2nd disk, causing problems such as corruption and/or data loss.

      11. If I fix the template manually via CLI to look like this, then it works as expected because a new DV object is create for every new VM from template

              - metadata:
                  name: ${NAME}-disk-tan-aardvark-13-clg7hj      <--- one DV per VM

      Ideally:

      • Take this into account when adding Disks to template, its currently dangerous to configure disks of templates via UI.
      • Maybe warn/error when a new template tries to creates a DV that already exists, not just re-use it (from backend as well?)

            upalatuc@redhat.com Ugo Palatucci
            rhn-support-gveitmic Germano Veit Michel
            Guohua Ouyang Guohua Ouyang
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: