-
Notifications
You must be signed in to change notification settings - Fork 170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VM snapshot clone and VM pvc expansion #11062
base: master
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: ayush-patni The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
ocs_ci/ocs/cnv/virtual_machine.py
Outdated
@@ -93,6 +94,7 @@ def create_vm_workload( | |||
access_mode=constants.ACCESS_MODE_RWX, | |||
pvc_size="30Gi", | |||
source_url=constants.CNV_CENTOS_SOURCE, | |||
pvc_obj=None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parikshit also added same parameter in his PR. It will conflict. #11045
ocs_ci/ocs/cnv/virtual_machine.py
Outdated
@@ -24,6 +24,7 @@ | |||
from ocs_ci.ocs.cnv.virtual_machine_instance import VirtualMachineInstance | |||
from ocs_ci.ocs import constants, ocp | |||
from ocs_ci.ocs.resources import pvc | |||
from ocs_ci.ocs.resources.pvc import PVC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as parikshit PR
ocs_ci/ocs/cnv/virtual_machine.py
Outdated
@@ -107,6 +109,7 @@ def create_vm_workload( | |||
sc_name (str): The name of the storage class to use. Default is `constants.DEFAULT_CNV_CEPH_RBD_SC`. | |||
pvc_size (str): The size of the PVC. Default is "30Gi". | |||
source_url (str): The URL of the vm registry image. Default is `constants.CNV_CENTOS_SOURCE` | |||
pvc_obj (obj, optional): PVC object to use existing pvc as a backend volume to VM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
ocs_ci/ocs/cnv/virtual_machine.py
Outdated
@@ -121,7 +124,12 @@ def create_vm_workload( | |||
self._add_ssh_key_to_vm(vm_data) | |||
|
|||
if volume_interface == constants.VM_VOLUME_PVC: | |||
self._create_vm_pvc(vm_data=vm_data) | |||
if pvc_obj: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
ocs_ci/ocs/cnv/virtual_machine.py
Outdated
@@ -280,6 +288,20 @@ def get(self, out_yaml_format=True): | |||
resource_name=self._vm_name, out_yaml_format=out_yaml_format | |||
) | |||
|
|||
def get_vm_pvc_obj(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
""" | ||
Test PVC expansion for a CNV VM workload | ||
""" | ||
vm_obj = cnv_workload( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use multi_cnv_workload fixture once my PR get merge.
new_size = random.randint(31, 35) | ||
log.info(vm_pvc_obj.size) | ||
vm_pvc_obj.resize_pvc(new_size) | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
write some data after PVC expansion. and check data integrity
volume_interface=constants.VM_VOLUME_PVC, | ||
source_url=constants.CNV_FEDORA_SOURCE, | ||
)[-1] | ||
vm_pvc_obj = vm_obj.get_vm_pvc_obj() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
write some data before PVC expansion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
assert source_csum == res_csum, ( | ||
f"Failed: MD5 comparison between source {vm_obj.name} and cloned " | ||
f"{res_vm_obj.name} VMs" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cloning of restored PVC step is missing.
# Resize PVC to a random size between 31 and 35 GiB | ||
new_size = random.randint(31, 35) | ||
log.info(vm_pvc_obj.size) | ||
vm_pvc_obj.resize_pvc(new_size) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check size is reflected on virtual machine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are just printing here size not verifying that size is increased.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added validation in assert statement
Signed-off-by: AYUSH-D-PATNI <[email protected]>
Signed-off-by: AYUSH-D-PATNI <[email protected]>
Signed-off-by: AYUSH-D-PATNI <[email protected]>
Signed-off-by: AYUSH-D-PATNI <[email protected]>
This PR consists of two test cases resp for CNV: VM snapshot clone and VM pvc expansion.