Skip to content

Commit

Permalink
[RADOS] 2056818: Add support for background RGW IOs
Browse files Browse the repository at this point in the history
Signed-off-by: Harsh Kumar <[email protected]>
  • Loading branch information
harshkumarRH committed Feb 5, 2025
1 parent 16fc6fe commit 88c688a
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 22 deletions.
82 changes: 82 additions & 0 deletions ceph/rados/core_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

from ceph.ceph_admin import CephAdmin
from ceph.parallel import parallel
from utility import utils
from utility.log import Log

log = Log(__name__)
Expand Down Expand Up @@ -4696,3 +4697,84 @@ def set_service_managed_type(self, service_type, unmanaged) -> bool:
return False
log.info(f" All {service_type} Service in unmanaged={unmanaged} state. Pass")
return True

def run_background_iops(self, ceph_client, duration):
"""
Method to trigger background IOPS on the cluster for a specific
duration using desired client
Note: Currently supports only RGW clientr
Args:
ceph_client: rgw | cephfs | rbd
duration: time for which I/Os should run (in secs)
returns:
Pass -> True, Fail -> false
"""
# To-do: add support for cephfs and rbd
log.info(f"Starting background IOs with {ceph_client} client")
config = dict()
try:
if ceph_client == "rgw":
# choose RGW node
rgw_node = self.ceph_cluster.get_nodes(role="rgw")[0]
rgw_node_ip = rgw_node.ip_address

# rgw qe scripts
config[
"git-url"
] = "https://github.com/red-hat-storage/ceph-qe-scripts.git"
home_dir_path = "/home/cephuser"
test_folder = "rgw-ms-tests"
test_folder_path = f"{home_dir_path}/{test_folder}"

# flushing iptables
log.info("flushing iptables")
self.client.exec_command(
cmd="sudo iptables -F", check_ec=False, sudo=True
)

# setup necessary directory
out, err = self.client.exec_command(
cmd=f"ls -l {test_folder_path}", check_ec=False, sudo=True
)
if not out:
self.client.exec_command(
cmd=f"sudo mkdir -p {test_folder_path}", sudo=True
)

# clone qe script repo
utils.clone_the_repo(config, self.client, test_folder_path)
out, err = self.client.exec_command(cmd="ls -l venv", check_ec=False)

# setup venv for running rgw scripts
if not out:
setup_cmds = [
"python3 -m venv venv",
"venv/bin/pip install --upgrade pip",
f"venv/bin/pip install -r {test_folder}/ceph-qe-scripts/rgw/requirements.txt",
]
for _cmd in setup_cmds:
self.client.exec_command(cmd=_cmd, sudo=True)
cfg_path = (
"/home/cephuser/rgw-ms-tests/ceph-qe-scripts/rgw/v2/tests/"
+ "s3_swift/multisite_configs/test_Mbuckets_with_Nobjects.yaml"
)

script_path = (
"/home/cephuser/rgw-ms-tests/ceph-qe-scripts/rgw/v2/tests/"
+ "s3_swift/test_Mbuckets_with_Nobjects.py"
)

# To-do: Find time taken to write 100 objects and adjust object count
# depending on input duration
obj_count = int(100 * duration / 3)
# modify object count to 1000
_cmd = f"sed -i 's/100/{obj_count}/g' {cfg_path}"
self.client.exec_command(cmd=_cmd, sudo=True)

run_cmd = f"sudo venv/bin/python {script_path} -c {cfg_path} --rgw-node {rgw_node_ip} &> /dev/null &"
self.client.exec_command(cmd=run_cmd, sudo=True, check_ec=False)
except Exception as e:
log.error(f"Execution failed with exception: {e.__doc__}")
log.exception(e)
return False
return True
23 changes: 1 addition & 22 deletions tests/rados/test_bilog_trim.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,29 +48,8 @@ def run(ceph_cluster, **kw):
rgw_node = ceph_cluster.get_nodes(role="rgw")[0]

try:
# to-do: Write a module to trigger background RGW IOs
"""
# start background IOs using RGW
log.info("Starting background IOs with RGW client")
cfg_path = (
"/home/cephuser/rgw-ms-tests/ceph-qe-scripts/rgw/v2/tests/"
+ "s3_swift/multisite_configs/test_Mbuckets_with_Nobjects.yaml"
)
script_path = (
"/home/cephuser/rgw-ms-tests/ceph-qe-scripts/rgw/v2/tests/"
+ "s3_swift/test_Mbuckets_with_Nobjects.py"
)
rgw_node_ip = rgw_node.ip_address
# modify object count to 1000
_cmd = f"sed -i 's/100/1000/g' {cfg_path}"
rados_obj.client.exec_command(cmd=_cmd, sudo=True)
run_cmd = f"sudo venv/bin/python {script_path} -c {cfg_path} --rgw-node {rgw_node_ip} &> /dev/null &"
rados_obj.client.exec_command(cmd=run_cmd, sudo=True, check_ec=False)
"""
rados_obj.run_background_iops(ceph_client="rgw", duration=600)

# set noout flag
if not rados_utils.configure_osd_flag(ceph_cluster, action="set", flag="noout"):
Expand Down

0 comments on commit 88c688a

Please sign in to comment.