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: ~~~ # 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: # 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 # 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:
verified on kubevirt-console-plugin-rhel9:v4.14.0-2359
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 (Important: OpenShift Virtualization 4.14.0 Images security and bug fix 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-2023:6817