-
Notifications
You must be signed in to change notification settings - Fork 169
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
create multiple cnv workloads #10673
Merged
PrasadDesala
merged 16 commits into
red-hat-storage:master
from
avd-sagare:multi-cnv-workload
Dec 19, 2024
+266
−1
Merged
Changes from 13 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
6aadc1a
create multiple cnv workloads
avd-sagare 620a8ea
upadte with storage class
avd-sagare ebbd1f9
Added fixture
avd-sagare a094fe4
changed fixure structure
avd-sagare a098c55
Moved file
avd-sagare 1441c20
Added testcase
avd-sagare 46283a5
commeneted compression code
avd-sagare d386218
Incorporated comments
avd-sagare 4de4aca
Incorporated comments
avd-sagare 6676e51
Incorporated comments
avd-sagare 8ff8e3d
Merge branch 'master' into multi-cnv-workload
avd-sagare 77acbb7
Update conftest.py
avd-sagare 530f85a
changed path and file name
avd-sagare 6b15523
Added changes
avd-sagare e15b229
Removed patch
avd-sagare d78e84e
Added doc string
avd-sagare File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
vm_configs: | ||
- volume_interface: PVC | ||
access_mode: ReadWriteMany | ||
sc_compression: default | ||
- volume_interface: PVC | ||
access_mode: ReadWriteMany | ||
sc_compression: aggressive | ||
- volume_interface: PVC | ||
access_mode: ReadWriteOnce | ||
sc_compression: default | ||
- volume_interface: DVT | ||
access_mode: ReadWriteMany | ||
sc_compression: default | ||
- volume_interface: DVT | ||
access_mode: ReadWriteMany | ||
sc_compression: aggressive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
128 changes: 128 additions & 0 deletions
128
tests/functional/workloads/cnv/test_multi_vm_configurations.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
import logging | ||
import pytest | ||
|
||
from ocs_ci.framework.testlib import E2ETest | ||
from ocs_ci.framework.pytest_customization.marks import workloads, magenta_squad | ||
from ocs_ci.helpers.cnv_helpers import cal_md5sum_vm | ||
from ocs_ci.helpers.performance_lib import run_oc_command | ||
from ocs_ci.helpers.keyrotation_helper import PVKeyrotation | ||
from ocs_ci.utility.utils import run_cmd | ||
from ocs_ci.ocs import constants | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
@magenta_squad | ||
class TestCNVVM(E2ETest): | ||
""" | ||
Includes tests related to CNV+ODF workloads. | ||
|
||
""" | ||
|
||
@pytest.fixture(autouse=True) | ||
def setup(self, project_factory, multi_cnv_workload): | ||
""" | ||
Setting up VMs for tests | ||
|
||
""" | ||
|
||
# Create a project | ||
proj_obj = project_factory() | ||
( | ||
self.vm_objs_def, | ||
self.vm_objs_aggr, | ||
self.sc_obj_def_compr, | ||
self.sc_obj_aggressive, | ||
) = multi_cnv_workload(namespace=proj_obj.namespace) | ||
|
||
logger.info("All vms created successfully") | ||
|
||
def verify_keyrotation(self, vm_objs, sc_obj): | ||
for vm in vm_objs: | ||
avd-sagare marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if vm.volume_interface == constants.VM_VOLUME_PVC: | ||
pvk_obj = PVKeyrotation(sc_obj) | ||
volume_name = vm.pvc_obj.get().get("spec", {}).get("volumeName") | ||
volume_handle = None | ||
for line in run_oc_command( | ||
f"describe pv {volume_name}", namespace=vm.namespace | ||
): | ||
if "VolumeHandle:" in line: | ||
volume_handle = line.split()[1] | ||
break | ||
if not volume_handle: | ||
logger.error(f"Cannot get volume handle for pv {volume_name}") | ||
raise Exception("Cannot get volume handle") | ||
assert pvk_obj.wait_till_keyrotation( | ||
volume_handle | ||
), f"Failed to rotate Key for the PVC {vm.pvc_obj.name}" | ||
|
||
@workloads | ||
@pytest.mark.polarion_id("OCS-6298") | ||
def test_cnv_vms(self, setup): | ||
PrasadDesala marked this conversation as resolved.
Show resolved
Hide resolved
|
||
""" | ||
Tests to verify configuration for non-GS like environment | ||
|
||
Steps: | ||
1) Create VMs using fixture multi_cnv_workload | ||
2) Validate data integrity using md5sum. | ||
a. create file locally and take md5sum | ||
b. copy same file to vm and take md5sum | ||
c. Validate both are same or not | ||
3) Validate pvc level key rotation | ||
4) Stop the VM | ||
5) Delete the VM (as part of factory teardown) | ||
|
||
""" | ||
|
||
# To Do | ||
# 1. if os is windows then check rxbounce enabled in sc yaml | ||
avd-sagare marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
all_vm_list = self.vm_objs_def + self.vm_objs_aggr | ||
|
||
# 2.Validate data integrity using md5sum. | ||
file_name = "/tmp/dd_file" | ||
vm_filepath = "/home/admin/dd_file1_copy" | ||
|
||
# Create file locally | ||
cmd = f"dd if=/dev/zero of={file_name} bs=1M count=1024" | ||
run_cmd(cmd) | ||
|
||
# Calculate the MD5 checksum | ||
if file_name: | ||
cmd = f"md5sum {file_name}" | ||
md5sum_on_local = run_cmd(cmd).split()[0] | ||
if md5sum_on_local: | ||
logger.info(f"MD5 checksum of the file: {md5sum_on_local}") | ||
else: | ||
raise ValueError( | ||
"MD5 checksum could not be calculated. Ensure the file exists and is accessible." | ||
) | ||
else: | ||
raise ValueError( | ||
"File name is not provided. Please specify a valid file name." | ||
) | ||
|
||
# Copy local file to all vms | ||
for vm_obj in all_vm_list: | ||
vm_obj.scp_to_vm( | ||
local_path=file_name, | ||
vm_dest_path=vm_filepath, | ||
) | ||
|
||
PrasadDesala marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# Take md5sum of copied file and compare with md5sum taken locally | ||
for vm_obj in all_vm_list: | ||
md5sum_on_vm = cal_md5sum_vm(vm_obj, vm_filepath, username=None) | ||
assert ( | ||
md5sum_on_vm == md5sum_on_local | ||
), f"md5sum has changed after copying file on {vm_obj.name}" | ||
|
||
# 3.Verify PV Keyrotation. | ||
# Process VMs with default compression | ||
self.verify_keyrotation(self.vm_objs_def, self.sc_obj_def_compr) | ||
|
||
# Process VMs with aggressive compression | ||
self.verify_keyrotation(self.vm_objs_aggr, self.sc_obj_aggressive) | ||
|
||
# 4.Stop all VMs | ||
for vm_obj in all_vm_list: | ||
vm_obj.stop() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
these are vm_configs, should we rename the file according to it, something like cnv_vm_config.yaml?
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.
the comment is to rename the file name not the dict key
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 will take this in next PR.