Bug 2100345 - 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
Summary: Cloning virtual machines is failing while creating DV with error "target reso...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Console Kubevirt Plugin
Version: 4.10
Hardware: All
OS: Linux
unspecified
high
Target Milestone: ---
: 4.10.z
Assignee: Aviv Turgeman
QA Contact: Guohua Ouyang
URL:
Whiteboard:
: 2100344 (view as bug list)
Depends On: 2102302
Blocks: 2102123
TreeView+ depends on / blocked
 
Reported: 2022-06-23 07:02 UTC by nijin ashok
Modified: 2023-09-15 01:56 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2102123 (view as bug list)
Environment:
Last Closed: 2022-07-11 15:27:56 UTC
Target Upstream Version:
Embargoed:
aturgema: needinfo-
aturgema: needinfo-


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift console pull 11770 0 None open [release-4.10] Bug 2100345: fix clone vm error creating DV 2022-06-29 15:38:11 UTC
Red Hat Knowledge Base (Solution) 6964682 0 None None None 2022-07-14 06:58:01 UTC
Red Hat Product Errata RHBA-2022:5513 0 None None None 2022-07-11 15:28:11 UTC

Description nijin ashok 2022-06-23 07:02:37 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 Bartosz Rybacki 2022-06-27 09:34:47 UTC
This is not a direct duplicate of https://bugzilla.redhat.com/show_bug.cgi?id=2084122, but the fix for 2084122 removes the validation hook that is clearly wrong in this situation. The fox for 2084122 moves the check to the controller, where the correct size can be evaluated and tested. 

Anyway, a new test has to be written to make sure all edge cases are handled.

Comment 2 Bartosz Rybacki 2022-06-27 11:53:55 UTC
How does cloning a VM work in UI? Is it creating a VM with DVTemplate? If yes, is it setting the Volume size?

If the answear to both is yes then I suppose the problem is within the OpenShift UI. And it might be a duplicate of this: https://bugzilla.redhat.com/show_bug.cgi?id=2088220.

The expected behavior is to always get the size from PVC. The DV is only the request to create the PVC. After PVC exists it can only be used to find the PVC and the size/capacity/ all the other values should be consulted with the actual PVC.

Comment 3 Bartosz Rybacki 2022-06-27 12:29:39 UTC
@tnisan I suppose this might actually be an Openshift console bug, can you help me verify it, or point me to someone who can?

Comment 4 nijin ashok 2022-06-28 06:10:12 UTC
(In reply to Bartosz Rybacki from comment #2)
> How does cloning a VM work in UI? Is it creating a VM with DVTemplate? If
> yes, is it setting the Volume size?
> 
> If the answear to both is yes then I suppose the problem is within the
> OpenShift UI. 

I think yes, it's an issue with the console. In my test, the cloning sets the DV template in the target VM yaml and set the size from the DV and not from the PVC. Also, the issue is not reproducible with spec.storage. I think it gets pvc size for spec.storage and DV size for spec.pvc as per  https://github.com/openshift/console/blob/f1b7d2a37bcea66481f677d9ae03c75741295e8d/frontend/packages/kubevirt-plugin/src/k8s/helpers/vm-clone.ts#L156

Comment 5 Adam Litke 2022-06-28 12:30:56 UTC
Moving to Console.  Tal, as the previous comment indicates, there is a discrepancy with how the clone size is determined based on how the DV Template looks in the source VM.  If the source VM uses the 'storage' API it fetches the size from the PVC.  This is the correct behavior.  However, if the source VM uses the 'pvc' API we fetch the size from the DataVolume spec.  This is not correct because the actual PVC size can be larger than the original DV request for various reasons.  The effect of this is that cloning VMs that use the 'pvc' API in the DVTemplate may not work correctly in the UI.

Comment 6 Yan Du 2022-06-29 12:46:56 UTC
*** Bug 2100344 has been marked as a duplicate of this bug. ***

Comment 7 Guohua Ouyang 2022-06-30 03:41:34 UTC
verified on 4.10.z branch with has this fix included.

Comment 8 Adam Litke 2022-06-30 12:31:47 UTC
Sorry if I missed it but will https://github.com/openshift/console/pull/11770 be backported also to 4.11?

Comment 9 Aviv Turgeman 2022-06-30 16:15:40 UTC
Hi @alitke 

This bug is was reproduced only for 4.10.z and below, 4.11 version and above this bug was not reproduced

Comment 10 Guohua Ouyang 2022-06-30 23:40:26 UTC
Is the bug https://bugzilla.redhat.com/show_bug.cgi?id=2102143 for 4.11?

Comment 11 Aviv Turgeman 2022-07-03 08:23:59 UTC
(In reply to Guohua Ouyang from comment #10)
> Is the bug https://bugzilla.redhat.com/show_bug.cgi?id=2102143 for 4.11?

Hi @gouyang 

The BZ you are mentioning is for 4.11.z and there should be another one at the `Depends on` section for the 4.12.0 BZ, and refers only to the not correct UI display of cloned size (the actual cloned size is correct)

Comment 12 Guohua Ouyang 2022-07-04 01:03:02 UTC
(In reply to Aviv Turgeman from comment #11)
> (In reply to Guohua Ouyang from comment #10)
> > Is the bug https://bugzilla.redhat.com/show_bug.cgi?id=2102143 for 4.11?
> 
> Hi @gouyang 
> 
> The BZ you are mentioning is for 4.11.z and there should be another one at
> the `Depends on` section for the 4.12.0 BZ, and refers only to the not
> correct UI display of cloned size (the actual cloned size is correct)

The 4.12 bug is https://bugzilla.redhat.com/show_bug.cgi?id=2102125

Comment 15 errata-xmlrpc 2022-07-11 15:27:56 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 (OpenShift Container Platform 4.10.22 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/RHBA-2022:5513

Comment 16 Red Hat Bugzilla 2023-09-15 01:56:14 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 365 days


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