Skip to content

Commit

Permalink
blustore Checked
Browse files Browse the repository at this point in the history
  • Loading branch information
Divya-78 committed Nov 25, 2024
1 parent 403427b commit 4265d98
Showing 1 changed file with 93 additions and 1 deletion.
94 changes: 93 additions & 1 deletion tests/rados/test_bluestore_min_alloc_size.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import re
import time
import json

from ceph.ceph_admin import CephAdmin
from ceph.rados import utils
Expand Down Expand Up @@ -114,6 +115,7 @@ def run(ceph_cluster, **kw):
daemon_type="osd", daemon_id=osd_id
)
log.debug(f"metadata details for OSD : {osd_id} is \n{osd_meta}\n")

if (
not min_alloc_size_hdd
== min_alloc_size_ssd
Expand All @@ -129,10 +131,56 @@ def run(ceph_cluster, **kw):
raise Exception(
"default values for min_alloc_size on cluster post changing"
)

log.info(
f"OSDs successfully deployed with the new alloc size, and verified the size on OSD: {osd_id}"
)
"""
enhance the tests by adding ceph config show osd.id and ceph daemon osd.id config show | grep min_alloc_size
"""
# Enhanced test: Check ceph config show and daemon output for each OSD
show_config_hdd = mon_obj.show_config(
daemon="osd", id=osd_id,param="bluestore_min_alloc_size_hdd")

show_config_ssd = mon_obj.show_config(
daemon="osd", id=osd_id,param="bluestore_min_alloc_size_ssd")


if not show_config_hdd == show_config_ssd == custom_min_alloc_size:
log.error(
f"min_alloc_size does not match the expected custom value of {custom_min_alloc_size}"
f"min_alloc_size_ssd on cluster: {show_config_ssd}"
f"min_alloc_size_hdd on cluster: {show_config_hdd}"
)
raise Exception("The output from ceph show is not as expected")

log.info("Ceph config show is successfully verified for the value of min_alloc_size")


# determine the OSD node for chosen osd
osd_node = rados_obj.fetch_host_node(
daemon_type="osd", daemon_id=f"osd.{osd_id}"
)

# determine osd's block device path
_cmd = f"cephadm shell -- ceph daemon osd.{osd_id} config show --format json"
json_str_out, _ = osd_node.exec_command(cmd=_cmd, sudo=True)
json_out = json.loads(json_str_out)
daemon_alloc_size_hdd = json_out['bluestore_min_alloc_size_hdd']
daemon_alloc_size_ssd = json_out['bluestore_min_alloc_size_ssd']

if not daemon_alloc_size_hdd == daemon_alloc_size_ssd == custom_min_alloc_size:
log.error(
f"min_alloc_size does not match the expected custom value of {custom_min_alloc_size}"
f"min_alloc_size_ssd on cluster: {daemon_alloc_size_ssd}"
f"min_alloc_size_hdd on cluster: {daemon_alloc_size_hdd}"
)
raise Exception("The output from ceph daemon is not as expected")

log.info("Ceph daemon is successfully verified for the value of min_alloc_size")

return 0


mon_obj.set_config(
section="osd",
Expand Down Expand Up @@ -212,6 +260,50 @@ def remove_osd_check_metadata(target_osd, alloc_size):
f"OSD : {rm_osd} could not be redeployed with alloc size {default_min_alloc_size}"
)
return 1
"""
add checks for ceph config show and ceph daemon with min_alloc_size
"""

show_config_hdd = mon_obj.show_config(
daemon="osd", id=osd_id,param="bluestore_min_alloc_size_hdd")

show_config_ssd = mon_obj.show_config(
daemon="osd", id=osd_id,param="bluestore_min_alloc_size_ssd")


if not show_config_hdd == show_config_ssd == default_min_alloc_size:
log.error(
f"min_alloc_size does not match the expected custom value of {default_min_alloc_size}"
f"min_alloc_size_ssd on cluster: {show_config_ssd}"
f"min_alloc_size_hdd on cluster: {show_config_hdd}"
)
raise Exception("Value not updated for min_alloc_size on cluster")

log.info("Successfully modified the value of min_alloc_size")

# determine the OSD node for chosen osd
osd_node = rados_obj.fetch_host_node(
daemon_type="osd", daemon_id=f"osd.{osd_id}"
)

# determine osd's block device path
_cmd = f"cephadm shell -- ceph daemon osd.{osd_id} config show --format json"
json_str_out, _ = osd_node.exec_command(cmd=_cmd, sudo=True)
json_out = json.loads(json_str_out)
daemon_alloc_size_hdd = json_out['bluestore_min_alloc_size_hdd']
daemon_alloc_size_ssd = json_out['bluestore_min_alloc_size_ssd']

if not daemon_alloc_size_hdd == daemon_alloc_size_ssd == default_min_alloc_size:
log.error(
f"min_alloc_size does not match the expected custom value of {default_min_alloc_size}"
f"min_alloc_size_ssd on cluster: {daemon_alloc_size_ssd}"
f"min_alloc_size_hdd on cluster: {daemon_alloc_size_hdd}"
)
raise Exception("Value not updated for min_alloc_size on cluster")

log.info("Successfully modified the value of min_alloc_size")


log.info(
f"OSD : {rm_osd} successfully redeployed with alloc size {default_min_alloc_size}"
)
Expand Down

0 comments on commit 4265d98

Please sign in to comment.