Bug 2100344

Summary: Cloning virtual machines is failing while creating DV with error "target resources requests storage size is smaller than the source" if source PVC is extended
Product: Container Native Virtualization (CNV) Reporter: nijin ashok <nashok>
Component: StorageAssignee: Adam Litke <alitke>
Status: CLOSED DUPLICATE QA Contact: Natalie Gavrielov <ngavrilo>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.10.2CC: cnv-qe-bugs, yadu
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-06-29 12:46:56 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description nijin ashok 2022-06-23 07:02:36 UTC
Description of problem:

Created a virtual machine with the below DV spec (spec.pvc)

~~~
oc get dv rhel8-cold-landfowl -o yaml |yq -y '.spec'
pvc:   <<<<
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 30Gi <<<
  storageClassName: ocs-external-storagecluster-ceph-rbd
  volumeMode: Block
~~~

After provisioning, extended the backend PVC to 40 GB.

~~~
rhel8-cold-landfowl            Bound    pvc-634e5504-6090-42c9-8dda-8490153bd34f   40Gi       RWX            ocs-external-storagecluster-ceph-rbd   17m
~~~

Used the OpenShift console and tried to clone the virtual machine. The cloned VM gets created with 30 GB instead of 40 GB.

~~~
oc get vm rhel8-cold-landfowl-clone -o yaml |yq -y '.spec.dataVolumeTemplates'
- metadata:
    creationTimestamp: null
    name: rhel8-cold-landfowl-clone-rhel8-cold-landfowl-tksun
  spec:
    pvc:
      accessModes:
        - ReadWriteMany
      resources:
        requests:
          storage: 30Gi
      storageClassName: ocs-external-storagecluster-ceph-rbd
      volumeMode: Block
    source:
      pvc:
        name: rhel8-cold-landfowl
        namespace: nijin-cnv
~~~

Because of this, the creation of cloned DV is failing with the error below:

~~~
3s          Warning   FailedDataVolumeCreate            virtualmachine/rhel8-cold-landfowl-clone                                    Error creating DataVolume rhel8-cold-landfowl-clone-rhel8-cold-landfowl-tksun: admission webhook "datavolume-validate.cdi.kubevirt.io" denied the request:  target resources requests storage size is smaller than the source
~~~

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

OpenShift Virtualization   4.10.2
OpenShift 4.10.15

How reproducible:

100%

Steps to Reproduce:
1. Create a VM with DV template 'spec.pvc'. 
2. Extend the PVC. 
3. Clone the VM. The cloned VM is taking the source DV size instead of PVC size. So the creation of cloned DV fails with the error "target resources requests storage size is smaller than the source".
  

Actual results:

Cloning virtual machines is failing while creating DV with error "target resources requests storage size is smaller than the source"

Expected results:

Cloning should work
Additional info:

Comment 1 Yan Du 2022-06-29 12:46:56 UTC

*** This bug has been marked as a duplicate of bug 2100345 ***