@@ -602,7 +602,10 @@ def check_health_warning(self, warning: str):
602
602
status_report = self .run_ceph_command (cmd = "ceph report" , client_exec = True )
603
603
ceph_health_status = list (status_report ["health" ]["checks" ].keys ())
604
604
if warning in ceph_health_status :
605
- log .info (f"warning: { warning } present on the cluster" )
605
+ log .info (
606
+ f"warning: { warning } present on the cluster"
607
+ f"all Generated warnings : { ceph_health_status } "
608
+ )
606
609
log .info (
607
610
f"Warning: { warning } generated on the cluster : { ceph_health_status } "
608
611
)
@@ -725,9 +728,13 @@ def collect_osd_daemon_ids(self, osd_node) -> list:
725
728
"""
726
729
The method is used to collect the various OSD daemons present on a particular node
727
730
:param osd_node: name of the OSD node on which osd daemon details are collected (ceph.ceph.CephNode): ceph node
731
+ or host-name in string can also be sent
728
732
:return: list of OSD ID's
729
733
"""
730
- cmd = f"sudo ceph osd ls-tree { osd_node .hostname } "
734
+ if isinstance (osd_node , str ):
735
+ cmd = f"sudo ceph osd ls-tree { osd_node } "
736
+ else :
737
+ cmd = f"sudo ceph osd ls-tree { osd_node .hostname } "
731
738
return self .run_ceph_command (cmd = cmd )
732
739
733
740
def enable_balancer (self , ** kwargs ) -> bool :
@@ -2673,7 +2680,7 @@ def list_orch_services(self, service_type=None, export=None) -> list:
2673
2680
if orch_ls_op :
2674
2681
return [service ["service_name" ] for service in orch_ls_op ]
2675
2682
2676
- def check_host_status (self , hostname , status : str = None ) -> bool :
2683
+ def check_host_status (self , hostname , status : str ) -> bool :
2677
2684
"""
2678
2685
Checks the status of host(offline or online) using
2679
2686
ceph orch host ls and return boolean
@@ -2685,13 +2692,13 @@ def check_host_status(self, hostname, status: str = None) -> bool:
2685
2692
"""
2686
2693
host_cmd = f"ceph orch host ls --host_pattern { hostname } "
2687
2694
out = self .run_ceph_command (cmd = host_cmd , client_exec = True )
2688
- host_status = out [ 0 ][ "status" ]. lower (). strip ()
2689
- log . info ( f"Status of the host is { host_status } " )
2690
- if status :
2695
+ if out :
2696
+ host_status = out [ 0 ][ "status" ]. lower (). strip ( )
2697
+ log . info ( "Status of the host : %s is %s" , hostname , host_status )
2691
2698
return True if status .lower () == host_status else False
2692
- elif "offline" in host_status :
2699
+ else :
2700
+ log .info ("Host : %s is not part of the cluster" , hostname )
2693
2701
return False
2694
- return True
2695
2702
2696
2703
def run_concurrent_io (self , pool_name : str , obj_name : str , obj_size : int ):
2697
2704
"""
@@ -4524,7 +4531,7 @@ def get_osd_list(self, status: str) -> list:
4524
4531
osd_dict [key ].append (entry ["id" ])
4525
4532
log .info (f"List of { key } OSDs: { osd_dict [key ]} " )
4526
4533
4527
- return osd_dict [status ]
4534
+ return osd_dict [status . lower () ]
4528
4535
4529
4536
def get_osd_details (self , osd_id : int ):
4530
4537
"""
0 commit comments