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'
storage: 30Gi <<<
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'
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
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".
Cloning virtual machines is failing while creating DV with error "target resources requests storage size is smaller than the source"
Cloning should work
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.
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.
@tnisan I suppose this might actually be an Openshift console bug, can you help me verify it, or point me to someone who can?
(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
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.
*** Bug 2100344 has been marked as a duplicate of this bug. ***
verified on 4.10.z branch with has this fix included.
Sorry if I missed it but will https://github.com/openshift/console/pull/11770 be backported also to 4.11?
This bug is was reproduced only for 4.10.z and below, 4.11 version and above this bug was not reproduced
Is the bug https://bugzilla.redhat.com/show_bug.cgi?id=2102143 for 4.11?
(In reply to Guohua Ouyang from comment #10)
> Is the bug https://bugzilla.redhat.com/show_bug.cgi?id=2102143 for 4.11?
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)
(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
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.