-
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 test case #11045
vm snapshot test case #11045
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,3 +62,60 @@ def test_vm_clone(self, cnv_workload, clone_vm_workload, setup_cnv): | |
), f"Failed: MD5 comparison between source {vm_obj.name} and cloned {clone_obj.name} VMs" | ||
run_dd_io(vm_obj=clone_obj, file_path=file_paths[1]) | ||
clone_obj.stop() | ||
|
||
@workloads | ||
@pytest.mark.polarion_id("OCS-6299") | ||
def test_vm_snapshot_ops( | ||
self, cnv_workload, snapshot_factory, snapshot_restore_factory, setup_cnv | ||
): | ||
""" | ||
This test performs the VM PVC snapshot operations | ||
|
||
Test steps: | ||
1. Create VMs, add data(e.g., files) to all the VMs | ||
2. Create a snapshot for a VM backed pvc | ||
3. Restore the snapshot (to same access mode of the parent PVC and storage_class) by following the | ||
documented procedure from ODF official docs | ||
4. Create new vm using restored pvc Verify existing data of the VM are not changed. | ||
5. Add further data(e.g., new file) to the VM | ||
6. Repeat the above procedure for all the VMs in the system | ||
7. Delete all the VMs created as part of this test | ||
""" | ||
file_paths = ["/file.txt", "/new_file.txt"] | ||
# TODO: Add multi_cnv fixture to configure VMs based on specifications | ||
vm_obj = cnv_workload( | ||
volume_interface=constants.VM_VOLUME_PVC, | ||
source_url=constants.CNV_FEDORA_SOURCE, | ||
)[0] | ||
# Writing IO on source VM | ||
source_csum = run_dd_io(vm_obj=vm_obj, file_path=file_paths[0], verify=True) | ||
# Stopping VM before taking snapshot of the VM PVC | ||
vm_obj.stop() | ||
# Taking Snapshot of PVC | ||
pvc_obj = vm_obj.get_vm_pvc_obj() | ||
snap_obj = snapshot_factory(pvc_obj) | ||
# Restore the snapshot | ||
res_snap_obj = snapshot_restore_factory( | ||
snapshot_obj=snap_obj, | ||
storageclass=vm_obj.sc_name, | ||
size=vm_obj.pvc_size, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ideally, the pvc size will be same as the restore size of snapshot. This is not a must and can be removed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure I am working on this and it will take care in my next PR |
||
volume_mode=snap_obj.parent_volume_mode, | ||
access_mode=vm_obj.pvc_access_mode, | ||
status=constants.STATUS_BOUND, | ||
timeout=300, | ||
) | ||
# Create new VM using the restored PVC | ||
res_vm_obj = cnv_workload( | ||
volume_interface=constants.VM_VOLUME_PVC, | ||
source_url=constants.CNV_FEDORA_SOURCE, | ||
existing_pvc_obj=res_snap_obj, | ||
namespace=vm_obj.namespace, | ||
)[1] | ||
# Write new file to VM | ||
run_dd_io(vm_obj=res_vm_obj, file_path=file_paths[1], verify=True) | ||
Comment on lines
+114
to
+115
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should be done after validating the data integrity There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure I am working on this and it will take care in my next PR |
||
# Validate data integrity of file written before taking snapshot | ||
res_csum = cal_md5sum_vm(vm_obj=res_vm_obj, file_path=file_paths[0]) | ||
assert ( | ||
source_csum == res_csum | ||
), f"Failed: MD5 comparison between source {vm_obj.name} and cloned {res_vm_obj.name} VMs" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the operation is restore not clone, please update the assert message accordingly There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure I am working on this and it will take care in my next PR |
||
res_vm_obj.stop() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. step 7 says "Delete all the VMs created as part of this test", here we are only stopping the VM, not deleting it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure I am working on this and it will take care in my next PR |
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.
Is deleting the restored VMs before the source causing any problems? At least in PVCs, IIRC, I don't think there will be any issues. The parent PVC can be deleted even with the restored PVC in use
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.
Sure I am working on this and I will take care of this in my next immediate PR.
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.
Based on avadhoot's comments, I will merge this PR as it's required urgently and low priority review comments will be handled in a followup PR