From 07026efb63f8a595869ca1c38f4de83825708645 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Thu, 9 Nov 2023 23:51:05 -0500 Subject: [PATCH] Ensure OSD checks in before completing Avoids issues where the new OSD doesn't check in; at least the administrator will know. Also fixes some issues with osd_db in removal. --- daemon-common/ceph.py | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/daemon-common/ceph.py b/daemon-common/ceph.py index ec4c9793..03b7abd9 100644 --- a/daemon-common/ceph.py +++ b/daemon-common/ceph.py @@ -1106,7 +1106,7 @@ def osd_worker_add_osd( split_count=None, ): current_stage = 0 - total_stages = 4 + total_stages = 5 if split_count is None: _split_count = 1 else: @@ -1398,7 +1398,30 @@ def osd_worker_add_osd( ] ) - # 6. Log it + # 6. Wait for OSD to check in + current_stage += 1 + update( + celery, + "Waiting for new OSD(s) to report stats", + current=current_stage, + total=total_stages, + ) + + last_osd = None + for osd in created_osds: + last_osd = osd + + while ( + jloads( + zkhandler.read( + ("osd.stats", created_osds[last_osd][0]["tags"]["ceph.osd_id"]) + ) + )["weight"] + == "|" + ): + time.sleep(1) + + # 7. Log it current_stage += 1 return finish( celery, @@ -2020,7 +2043,7 @@ def osd_worker_remove_osd( total_stages += 1 if not skip_zap_flag: total_stages += 2 - if db_device is not None: + if db_device: total_stages += 1 start( @@ -2243,7 +2266,7 @@ def osd_worker_remove_osd( ) # 6. Remove the DB device - if db_device is not None: + if db_device: current_stage += 1 update( celery,