From dcb0adb3257643869e68738597c1ae9f18ca0278 Mon Sep 17 00:00:00 2001 From: pdivyagowri Date: Mon, 3 Feb 2025 16:53:14 +0530 Subject: [PATCH] Added printing of log lines at OSD booting Signed-off-by: pdivyagowri --- tests/rados/test_bluestore_min_alloc_size.py | 48 ++++++++++++++++++-- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/tests/rados/test_bluestore_min_alloc_size.py b/tests/rados/test_bluestore_min_alloc_size.py index 4d20901f7c1..3fb31fe364e 100644 --- a/tests/rados/test_bluestore_min_alloc_size.py +++ b/tests/rados/test_bluestore_min_alloc_size.py @@ -166,6 +166,12 @@ def run(ceph_cluster, **kw): daemon_alloc_size_hdd = int(json_out["bluestore_min_alloc_size_hdd"]) daemon_alloc_size_ssd = int(json_out["bluestore_min_alloc_size_ssd"]) + log.debug( + f"Bluestore min alloc size hdd for daemon config show is: {daemon_alloc_size_hdd}" + ) + log.debug( + f"Bluestore min alloc size ssd for daemon config show is: {daemon_alloc_size_ssd}" + ) if not ( daemon_alloc_size_hdd @@ -180,8 +186,6 @@ def run(ceph_cluster, **kw): raise Exception("The output from ceph daemon is not as expected") log.info("Ceph daemon is verified") - return 0 - mon_obj.set_config( section="osd", name="bluestore_min_alloc_size_hdd", @@ -225,12 +229,40 @@ def remove_osd_check_metadata(target_osd, alloc_size): # Adding the removed OSD back and checking the cluster status + start_time, _ = test_host.exec_command( + cmd="sudo date '+%Y-%m-%d %H:%M:%S'" + ) + log.debug("Adding the removed OSD back and checking the cluster status") utils.add_osd(ceph_cluster, test_host.hostname, dev_path, target_osd) method_should_succeed( wait_for_device_rados, test_host, target_osd, action="add" ) time.sleep(30) + + end_time, _ = test_host.exec_command( + cmd="sudo date '+%Y-%m-%d %H:%M:%S'" + ) + + log_veri = rados_obj.get_journalctl_log( + start_time=start_time, + end_time=end_time, + daemon_type="osd", + daemon_id=target_osd, + ) + log.debug(f"The log lines for the OSD: {target_osd} is :{log_veri}") + + # If _open_super_meta min_alloc_size is found in the logs, print the log lines + if f"_open_super_meta min_alloc_size {hex(4096)}" in log_veri: + log.info( + f"Found '_open_super_meta min_alloc_size {hex(4096)}' in the logs for OSD {target_osd}" + ) + else: + log.error( + f"Error: '_open_super_meta min_alloc_size' not found in the logs for OSD {target_osd}" + ) + raise Exception(f"Desired log '_open_super_meta min_alloc_size {hex(4096)}' not found for OSD {target_osd}") + log.debug( "Completed addition of OSD post removal. Checking bluestore_min_alloc_size value post OSD addition" ) @@ -267,12 +299,12 @@ def remove_osd_check_metadata(target_osd, alloc_size): show_config_hdd = int( mon_obj.show_config( - daemon="osd", id=osd_id, param="bluestore_min_alloc_size_hdd" + daemon="osd", id=rm_osd, param="bluestore_min_alloc_size_hdd" ) ) show_config_ssd = int( mon_obj.show_config( - daemon="osd", id=osd_id, param="bluestore_min_alloc_size_ssd" + daemon="osd", id=rm_osd, param="bluestore_min_alloc_size_ssd" ) ) @@ -288,11 +320,17 @@ def remove_osd_check_metadata(target_osd, alloc_size): # determine osd's block device path json_out = mon_obj.daemon_config_show( - daemon_type="osd", daemon_id=osd_id + daemon_type="osd", daemon_id=rm_osd ) daemon_alloc_size_hdd = int(json_out["bluestore_min_alloc_size_hdd"]) daemon_alloc_size_ssd = int(json_out["bluestore_min_alloc_size_ssd"]) + log.debug( + f"Bluestore min alloc size hdd for daemon config show is: {daemon_alloc_size_hdd}" + ) + log.debug( + f"Bluestore min alloc size ssd for daemon config show is: {daemon_alloc_size_ssd}" + ) if not ( daemon_alloc_size_hdd