Bug 2224203 - Clone VM is cloning from the VMs DV source and not from the VM PVC
Summary: Clone VM is cloning from the VMs DV source and not from the VM PVC
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Container Native Virtualization (CNV)
Classification: Red Hat
Component: User Experience
Version: 4.13.4
Hardware: All
OS: Linux
unspecified
high
Target Milestone: ---
: 4.14.0
Assignee: Tal Nisan
QA Contact: Guohua Ouyang
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-07-20 07:50 UTC by nijin ashok
Modified: 2023-11-13 08:11 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-11-08 14:06:02 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker CNV-31188 0 None None None 2023-07-20 07:53:30 UTC
Red Hat Issue Tracker CNV-32601 0 None None None 2023-09-24 16:30:30 UTC
Red Hat Issue Tracker CNV-33504 0 None None None 2023-11-13 08:11:53 UTC
Red Hat Knowledge Base (Solution) 7031458 0 None None None 2023-09-01 06:41:40 UTC
Red Hat Product Errata RHSA-2023:6817 0 None None None 2023-11-08 14:06:16 UTC

Description nijin ashok 2023-07-20 07:50:03 UTC
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:

Comment 1 Guohua Ouyang 2023-08-01 10:34:43 UTC
verified on kubevirt-console-plugin-rhel9:v4.14.0-2359

Comment 3 errata-xmlrpc 2023-11-08 14:06:02 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 (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


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