From 25371c1574d9d04a275494f7c788959396fda1df Mon Sep 17 00:00:00 2001 From: Tobias Wolf Date: Tue, 5 Nov 2024 09:36:13 +0100 Subject: [PATCH 1/3] Be more permissive for Ceph RGW services to be empty in `migrate_rgws` Fixes: #98 Signed-off-by: Tobias Wolf --- src/rookify/modules/migrate_rgws/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/rookify/modules/migrate_rgws/main.py b/src/rookify/modules/migrate_rgws/main.py index fc11c55..d0a1422 100644 --- a/src/rookify/modules/migrate_rgws/main.py +++ b/src/rookify/modules/migrate_rgws/main.py @@ -98,7 +98,9 @@ def _migrate_rgw(self, rgw_host: str) -> None: ceph_status = self.ceph.mon_command("status") rgw_daemon_hosts = self._get_rgw_daemon_hosts_of_map( - ceph_status["servicemap"]["services"]["rgw"]["daemons"] + ceph_status["servicemap"]["services"] + .get("rgw", {}) + .get("daemons", {}) ) if rgw_host not in rgw_daemon_hosts: From bcdf8255e305ad9d73ff1cb73f9f250a8169c67e Mon Sep 17 00:00:00 2001 From: Tobias Wolf Date: Thu, 7 Nov 2024 18:25:13 +0100 Subject: [PATCH 2/3] Ensure we are validating current Ceph status data for migration Changes introduced in #86 and updated in #93 only partly considered when data is taken from `analyze_ceph` and when to query Ceph for current status data. This resulted in always assuming RGW daemons got successfully migrated immediately. Signed-off-by: Tobias Wolf --- src/rookify/modules/migrate_rgws/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/rookify/modules/migrate_rgws/main.py b/src/rookify/modules/migrate_rgws/main.py index aaa4e25..d80e76c 100644 --- a/src/rookify/modules/migrate_rgws/main.py +++ b/src/rookify/modules/migrate_rgws/main.py @@ -137,7 +137,11 @@ def _migrate_rgw(self, rgw_host: str) -> None: ) while True: - rgw_daemon_hosts = self._get_rgw_daemon_hosts() + ceph_status = self.ceph.mon_command("status") + + rgw_daemon_hosts = self._get_rgw_daemon_hosts_of_map( + ceph_status["servicemap"]["services"]["rgw"]["daemons"] + ) if rgw_host in rgw_daemon_hosts: break From bf43aa558f8a5705a42fa843391f83fe9e766756 Mon Sep 17 00:00:00 2001 From: Tobias Wolf Date: Sun, 10 Nov 2024 15:06:09 +0100 Subject: [PATCH 3/3] Adapt to changes of PR #101 Signed-off-by: Tobias Wolf --- src/rookify/modules/migrate_rgws/main.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/rookify/modules/migrate_rgws/main.py b/src/rookify/modules/migrate_rgws/main.py index eb92cb3..c6760cb 100644 --- a/src/rookify/modules/migrate_rgws/main.py +++ b/src/rookify/modules/migrate_rgws/main.py @@ -14,7 +14,9 @@ def _get_rgw_daemon_hosts(self) -> List[str]: state_data = self.machine.get_preflight_state("AnalyzeCephHandler").data return self._get_rgw_daemon_hosts_of_map( - state_data["report"]["servicemap"]["services"]["rgw"]["daemons"] + state_data["report"]["servicemap"]["services"] + .get("rgw", {}) + .get("daemons", {}) ) def _get_rgw_daemon_hosts_of_map( @@ -142,7 +144,9 @@ def _migrate_rgw(self, rgw_host: str) -> None: ceph_status = self.ceph.mon_command("status") rgw_daemon_hosts = self._get_rgw_daemon_hosts_of_map( - ceph_status["servicemap"]["services"]["rgw"]["daemons"] + ceph_status["servicemap"]["services"] + .get("rgw", {}) + .get("daemons", {}) ) if rgw_host in rgw_daemon_hosts: