-
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 hot plugging and unplugging #11149
base: master
Are you sure you want to change the base?
Conversation
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]>
Signed-off-by: AYUSH-D-PATNI <[email protected]>
…e_disk_hot_plugging_unplugging.py Signed-off-by: AYUSH-D-PATNI <[email protected]>
Signed-off-by: AYUSH-D-PATNI <[email protected]>
Signed-off-by: AYUSH-D-PATNI <[email protected]>
[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 |
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.
PR validation on existing cluster
Cluster Name: apatni-cnv-hotpl2
Cluster Configuration:
PR Test Suite:
PR Test Path: tests/functional/workloads/cnv/test_vm_hotplug_unplug.py
Additional Test Params:
OCP VERSION: 4.18
OCS VERSION: 4.18
tested against branch: master
Job UNSTABLE (some or all tests failed).
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.
PR validation on existing cluster
Cluster Name: apatni-cnv-hotpl2
Cluster Configuration:
PR Test Suite:
PR Test Path: tests/functional/workloads/cnv/test_vm_hotplug_unplug.py
Additional Test Params:
OCP VERSION: 4.18
OCS VERSION: 4.18
tested against branch: master
Job UNSTABLE (some or all tests failed).
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.
PR validation on existing cluster
Cluster Name: apatni-cnv-hotpl2
Cluster Configuration:
PR Test Suite:
PR Test Path: tests/functional/workloads/cnv/test_vm_hotplug_unplug.py
Additional Test Params:
OCP VERSION: 4.18
OCS VERSION: 4.18
tested against branch: master
Job UNSTABLE (some or all tests failed).
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.
PR validation on existing cluster
Cluster Name: apatni-cnv-hotpl2
Cluster Configuration:
PR Test Suite:
PR Test Path: tests/functional/workloads/cnv/test_vm_hotplug_unplug.py
Additional Test Params:
OCP VERSION: 4.18
OCS VERSION: 4.18
tested against branch: master
ocs_ci/helpers/cnv_helpers.py
Outdated
volume_name (str): Name of the volume to verify | ||
|
||
Returns: | ||
str: stdout of command |
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.
return is bool
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
vm_obj.restart(wait=True, verify=True) | ||
|
||
# Verify that the disk is still attached | ||
verifyvolume(vm_obj, volume_name=pvc_obj.name) |
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.
assert here if verification is not successfull
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
), f"Failed to unplug disk from VM {vm_obj.name}" | ||
|
||
# Confirm disk removal | ||
if not verifyvolume(vm_obj, volume_name=pvc_obj.name): |
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.
assert here as well
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
) | ||
run_dd_io(vm_obj=vm_obj, file_path=file_paths[1]) | ||
else: | ||
pytest.fail( |
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.
can be part of assert message
|
||
# Hotplug the PVC to the VM | ||
vm_obj.addvolume(volume_name=pvc_obj.name) | ||
verifyvolume(vm_obj, volume_name=pvc_obj.name) |
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.
assert here as well
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
|
||
@magenta_squad | ||
@workloads | ||
@pytest.mark.polarion_id("OCS-") |
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.
polarion id
9. login into VM and confirm disk is no longer listed. | ||
10 Repeat the above tests for DVT based 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.
Please consider making this as common function(s) so it can be used by other tests
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.
As per today's discussion, we'll be updating addvolume as enhancement
https://github.com/red-hat-storage/ocs-ci/pull/11149/files#r1923196525
Signed-off-by: AYUSH-D-PATNI <[email protected]>
log.info(f"Disks before hotplug:\n{before_disks}") | ||
|
||
# Hotplug the PVC to the VM | ||
vm_obj.addvolume(volume_name=pvc_obj.name) |
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.
can we add multiple hot disks?
cmd = f"oc get vm {vm_obj.name} -o=jsonpath='{{.spec.volumes}}'" | ||
output = run_cmd(cmd=cmd) |
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 replace it with vm_obj.get()
|
||
Args: | ||
vm_obj (str): vm obj | ||
volume_name (str): Name of the volume to verify |
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.
volume_name (str): Name of the volume to verify | |
volume_name (str): Name of the volume (PVC) to verify |
# Perform I/O operation on the new disk | ||
log.info( | ||
f"Running I/O operation on the newly attached disk in VM {vm_obj.name}" | ||
) |
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.
from the log message, it looks like you are running IO to the newly attached disk. How are you making sure that the created file indeed goes to the new disk?
@@ -33,5 +33,5 @@ def test_vm_single_disk_hot_plugging_unplugging(self, cnv_workload, setup_cnv): | |||
access_mode=constants.ACCESS_MODE_RWX, | |||
volume_mode=constants.VOLUME_MODE_BLOCK, | |||
) | |||
vm_obj.addvolme(volume_name=pvc_obj.name) | |||
vm_obj.addvolume(volume_name=pvc_obj.name) |
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.
since this test is covered with the new test in this PR, the old test can be depreciated
assert verifyvolume( | ||
vm_obj, volume_name=pvc_obj.name | ||
), f"Unable to found volume {pvc_obj.name} mounted on VM: {vm_obj.name}" |
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 add an additional arg like verify the addvolume function and move the verification code under it in the function. that way you can remove the repeated verification code in the test calling that function
This PR consists of test cases resp for CNV: Verify that hotplugging and hot unplugging of a PVC to/from a VM works