Skip to content

Commit

Permalink
Added changes
Browse files Browse the repository at this point in the history
Signed-off-by: Avdhoot <[email protected]>
  • Loading branch information
avd-sagare committed Dec 18, 2024
1 parent 530f85a commit 6b15523
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 20 deletions.
2 changes: 1 addition & 1 deletion ocs_ci/templates/cnv-vm-workload/cnv_vm_workload.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
vm_configs:
cnv_vm_configs:
- volume_interface: PVC
access_mode: ReadWriteMany
sc_compression: default
Expand Down
10 changes: 2 additions & 8 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7103,7 +7103,7 @@ def multi_cnv_workload(
Fixture to create virtual machines (VMs) with specific configurations.
This fixture sets up multiple VMs with varying storage configurations as specified
in the `vm_configs` yaml. Each VM configuration includes the volume interface type,
in the `cnv_vm_workload.yaml`. Each VM configuration includes the volume interface type,
access mode, and the storage class to be used.
The configurations applied to the VMs are:
Expand Down Expand Up @@ -7166,7 +7166,6 @@ def factory(namespace=None):
log.info(f"Successfully patched parameters for storage class: {sc}")
except Exception as e:
log.info(f"Failed to patch storage class {sc}: {e}")
continue

# Create ceph-csi-kms-token in the tenant namespace
kms.vault_path_token = kms.generate_vault_token()
Expand All @@ -7180,17 +7179,12 @@ def factory(namespace=None):
vm_configs = templating.load_yaml(constants.CNV_VM_WORKLOADS)

# Loop through vm_configs and create the VMs using the cnv_workload fixture
for index, vm_config in enumerate(vm_configs["vm_configs"]):
for index, vm_config in enumerate(vm_configs["cnv_vm_configs"]):
# Determine the storage class based on the compression type
if vm_config["sc_compression"] == "default":
storageclass = sc_obj_def_compr.name
elif vm_config["sc_compression"] == "aggressive":
storageclass = sc_obj_aggressive.name
else:
raise ValueError(
f"Unknown storage class compression type: {vm_config['sc_name']}"
)

vm_obj = cnv_workload(
volume_interface=vm_config["volume_interface"],
access_mode=vm_config["access_mode"],
Expand Down
23 changes: 12 additions & 11 deletions tests/functional/workloads/cnv/test_multi_vm_configurations.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ def setup(self, project_factory, multi_cnv_workload):
logger.info("All vms created successfully")

def verify_keyrotation(self, vm_objs, sc_obj):
"""
Verify the keyrotation is succeed.
Args:
vm_objs (obj): virtual machine Object
sc_obj (obj): storage class object
"""
for vm in vm_objs:
if vm.volume_interface == constants.VM_VOLUME_PVC:
pvk_obj = PVKeyrotation(sc_obj)
Expand All @@ -58,7 +66,7 @@ def verify_keyrotation(self, vm_objs, sc_obj):

@workloads
@pytest.mark.polarion_id("OCS-6298")
def test_cnv_vms(self, setup):
def test_cnv_vms(self, setup, setup_cnv):
"""
Tests to verify configuration for non-GS like environment
Expand All @@ -74,19 +82,15 @@ def test_cnv_vms(self, setup):
"""

# To Do
# 1. if os is windows then check rxbounce enabled in sc yaml

all_vm_list = self.vm_objs_def + self.vm_objs_aggr

# 2.Validate data integrity using md5sum.
# 1.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}"
Expand All @@ -101,28 +105,25 @@ def test_cnv_vms(self, setup):
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,
)

# 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.
# 2.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
# 3.Stop all VMs
for vm_obj in all_vm_list:
vm_obj.stop()

0 comments on commit 6b15523

Please sign in to comment.