Skip to content
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

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

avd-sagare
Copy link
Contributor

No description provided.

@avd-sagare avd-sagare requested a review from a team as a code owner October 14, 2024 14:38
@pull-request-size pull-request-size bot added the size/M PR that changes 30-99 lines label Oct 14, 2024
Copy link

openshift-ci bot commented Oct 14, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: avd-sagare

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@pull-request-size pull-request-size bot added size/L PR that changes 100-499 lines and removed size/M PR that changes 30-99 lines labels Oct 15, 2024
@avd-sagare avd-sagare force-pushed the multi-cnv-workload branch 3 times, most recently from 8a1c795 to 5ded88a Compare November 19, 2024 05:54
@avd-sagare avd-sagare force-pushed the multi-cnv-workload branch 2 times, most recently from 5d52616 to 616acfb Compare November 26, 2024 16:28
tests/conftest.py Outdated Show resolved Hide resolved
vm_list_default_compr = []

"""
Setup csi-kms-connection-details configmap
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be commented instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

def factory(namespace=None):
"""
Args:
namespace:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

elaborate the namespace.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

source_url=constants.CNV_FEDORA_SOURCE, # Assuming source_url is the same for all VMs
namespace=namespace,
)
vm_obj = vm_obj[-1]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the need for last vm_obj in the cnv_vm_objs list?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually cnv_workload gives list and everytime new obj is append on vm-obj list..So I am picking up last added vm object.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can get the index of current iteration by enumerating

tests/functional/cnv/test_vms.py Show resolved Hide resolved
tests/functional/cnv/test_vms.py Show resolved Hide resolved
tests/functional/cnv/test_vms.py Outdated Show resolved Hide resolved
Signed-off-by: Avdhoot <[email protected]>
vm_list_agg_compr = []
vm_list_default_compr = []

namespace = (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

namespace will be created in vm class if no namespace is provided. So no need to create a specific ns here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to create namespace here because I need to create csi kms token where we are creating vm pvc.

@@ -7092,6 +7092,112 @@ def teardown():
return factory


@pytest.fixture
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@pytest.fixture
@pytest.fixture()

Comment on lines 7100 to 7101
Create a cnv factory. Calling this fixture Creates multiple VMs
with specified configurations using the cnv_workload fixture.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please elaborate the fixture description as discussed

namespace if namespace else create_unique_resource_name("vm", "namespace")
)

# Setup csi-kms-connection-details configmap
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't this be done as part of the cluster deployment with KMS?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we are creating new customize encrypted storageclass, we can't do at during cluster deployment.

Comment on lines 7191 to 7195
return (
vm_list_default_compr,
vm_list_agg_compr,
sc_obj_aggressive,
sc_obj_def_compr,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason for categ the VMs this way? can we return a single list of VM objects and get the required data from those?

@@ -0,0 +1,144 @@
import logging
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please provide a more meaningful test case name

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

run_cmd(cmd)

# Calculate the MD5 checksum
if file_path:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

throw exceptions when the file path and md5sum_on_loca are not found

md5sum_on_vm = cal_md5sum_vm(vm_obj, vm_filepath, username=None)
assert (
md5sum_on_vm == md5sum_on_local
), f"md5sum has not changed after copying file on {vm_obj.name}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be, md5sum changed?

md5sum_on_vm = cal_md5sum_vm(vm_obj, vm_filepath, username=None)
assert (
md5sum_on_vm == md5sum_on_local
), f"md5sum has not changed after copying file on {vm_obj.name}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be, md5sum changed?

Comment on lines 128 to 137
volume_name = vm.pvc_obj.get().get("spec").get("volumeName")
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 volume_handle is None:
logger.error(f"Cannot get volume handle for pv {volume_name}")
raise Exception("Cannot get volume handle")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is for getting the pv name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no for getting volume handle name of PV

Comment on lines 142 to 144
# 4.Stop all VMs
for vm_obj in self.vm_objs_def + self.vm_objs_aggr:
vm_obj.stop()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't this part of the test case? do we need this, shouldn't the fixture teardown take care of stopping the VM's?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compression="aggressive",
new_rbd_pool=True,
)
vm_configs = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imo, you can add these configs by create cnv_workload.yaml file

log.info("csi-kms-connection-details setup successful")

# Create an encryption enabled storageclass for RBD
sc_obj_def_compr = storageclass_factory(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sc created should have ceph-rbd-virt sc params. Please check and patch if necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

new_rbd_pool=True,
)

sc_obj_aggressive = storageclass_factory(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

source_url=constants.CNV_FEDORA_SOURCE, # Assuming source_url is the same for all VMs
namespace=namespace,
)
vm_obj = vm_obj[-1]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can get the index of current iteration by enumerating

compression="aggressive",
new_rbd_pool=True,
)
vm_configs = [
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make sure you cover all RWX and at least one RWO configs from here

kms = pv_encryption_kms_setup_factory(kv_version="v2")
log.info("csi-kms-connection-details setup successful")

# Create an encryption enabled storageclass for RBD
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use rbd virtualization storageclass here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Signed-off-by: Avdhoot <[email protected]>
Signed-off-by: Avdhoot <[email protected]>
Signed-off-by: Avdhoot <[email protected]>
ocs-ci

This comment was marked as duplicate.

ocs-ci

This comment was marked as outdated.

Copy link

@ocs-ci ocs-ci left a 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: asagare-cnv8
Cluster Configuration:
PR Test Suite:
PR Test Path: tests/functional/cnv/test_vms.py
Additional Test Params:
OCP VERSION: 4.18
OCS VERSION: 4.18
tested against branch: master

Job PASSED.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/L PR that changes 100-499 lines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants