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

[2224203] Clone VM is cloning from the VMs DV source and not from the VM PVC

XMLWordPrintable

    • High
    • No

      Description of problem:

      Created a VM rhel8-source-vm from the template and got dataVolumeTemplates as below:

      ~~~
      oc get vm rhel8-source-vm -o yaml |yq '.spec.dataVolumeTemplates'

      • apiVersion: cdi.kubevirt.io/v1beta1
        kind: DataVolume
        metadata:
        creationTimestamp: null
        name: rhel8-source-vm
        spec:
        sourceRef:
        kind: DataSource
        name: rhel8
        namespace: openshift-virtualization-os-images
        storage:
        resources:
        requests:
        storage: 30Gi
        ~~~

      The VM is using DV and PVC named rhel8-source-vm:

      ~~~

      1. oc get vm rhel8-source-vm -o yaml |yq '.spec.template.spec.volumes[0]'
        dataVolume:
        name: rhel8-source-vm
        name: rootdisk
        ~~~

      Now if I clone this VM, it should clone PVC rhel8-source-vm to get the copy of the VM, but instead, it is cloning from rhel8 DataSource.

      ~~~

      PVC of Datsource rhel8 is rhel8-0da894200daa:

      1. oc get datasource rhel8 -o yaml -n openshift-virtualization-os-images |yq '.spec.source.pvc'
        name: rhel8-0da894200daa
        namespace: openshift-virtualization-os-images

      Cloned DV, VM and PVC showing source as PVC rhel8-0da894200daa:

      • apiVersion: cdi.kubevirt.io/v1beta1
        kind: DataVolume
        metadata:
        ...
        ...
        name: rhel8-source-vm-volume-clone
        namespace: new-nijin-cnv
        ....
        spec:
        source:
        pvc:
        name: rhel8-0da894200daa <====
        namespace: openshift-virtualization-os-images
        storage:
        resources:
        requests:
        storage: 30Gi
      1. oc get vm rhel8-source-vm-clone -o yaml| yq '.spec.dataVolumeTemplates'
      • apiVersion: cdi.kubevirt.io/v1beta1
        kind: DataVolume
        metadata:
        creationTimestamp: null
        name: rhel8-source-vm-volume-clone
        spec:
        sourceRef:
        kind: DataSource <====
        name: rhel8
        namespace: openshift-virtualization-os-images
        storage:
        resources:
        requests:
        storage: 30Gi

      oc get pvc rhel8-source-vm-volume-clone -o yaml |yq '.spec.dataSource'
      apiGroup: null
      kind: PersistentVolumeClaim
      name: rhel8-0da894200daa
      ~~~

      Is this [1] comparing dataVolumeTemplates.metadata.name and volumes.dataVolume.name after appending "-volume-clone" ? Then that will be always true.

      [1] https://github.com/kubevirt-ui/kubevirt-plugin/blob/main/src/views/virtualmachines/actions/components/CloneVMModal/utils/helpers.tsx#L176

      Version-Release number of selected component (if applicable):

      OpenShift Virtualization 4.13.2

      How reproducible:

      100 %

      Steps to Reproduce:

      1. Clone a VM from the OpenShift console.
      2. Inspect the cloned VM's dataVolumeTemplates and PVC source. It will be cloned from the source VMs DV source and not from the source VM PVC.

      Actual results:

      Clone VM is cloning from the source VMs DV source and not from the source VM PVC

      Expected results:

      To get the copy of the VM, it should copy the PVC being used by the VM and not from where the VM was created.

      Additional info:

            tnisan@redhat.com Tal Nisan
            rhn-support-nashok Nijin Ashok
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: