diff --git a/src/rookify/modules/ceph.py b/src/rookify/modules/ceph.py index ba16b87..ddc3ed2 100644 --- a/src/rookify/modules/ceph.py +++ b/src/rookify/modules/ceph.py @@ -32,7 +32,7 @@ def _json_command(self, handler: Any, *args: Any) -> Any: return data - def get_osd_pool_configurations_from_osd_dump( + def get_osd_pool_configurations_from_map( self, dump_data: Dict[str, Any] ) -> Dict[str, Any]: osd_pools = {osd_pool["pool_name"]: osd_pool for osd_pool in dump_data["pools"]} diff --git a/src/rookify/modules/create_rook_resources/main.py b/src/rookify/modules/create_rook_resources/main.py index 2cceccd..b683cf9 100644 --- a/src/rookify/modules/create_rook_resources/main.py +++ b/src/rookify/modules/create_rook_resources/main.py @@ -36,7 +36,7 @@ def __create_configmap_definition(self) -> None: configmap_data = { "data": configmap_mon_list, "mapping": json.dumps({"node": mapping}), - "maxMonId": "{0:d}".format(len(state_data["mon"]["dump"]["mons"])), + "maxMonId": "{0:d}".format(len(state_data["report"]["monmap"]["mons"])), } configmap = kubernetes.client.V1ConfigMap( diff --git a/src/rookify/modules/migrate_mds_pools/main.py b/src/rookify/modules/migrate_mds_pools/main.py index bcae3b4..bd84cf5 100644 --- a/src/rookify/modules/migrate_mds_pools/main.py +++ b/src/rookify/modules/migrate_mds_pools/main.py @@ -16,8 +16,8 @@ def preflight(self) -> None: "MigrateMdsPoolsHandler", "pools", default_value={} ) - osd_pools = self.ceph.get_osd_pool_configurations_from_osd_dump( - state_data["osd"]["dump"] + osd_pools = self.ceph.get_osd_pool_configurations_from_map( + state_data["report"]["osdmap"] ) for mds_fs_data in state_data["fs"]["ls"]: diff --git a/src/rookify/modules/migrate_osd_pools/main.py b/src/rookify/modules/migrate_osd_pools/main.py index 406a0f5..6224da7 100644 --- a/src/rookify/modules/migrate_osd_pools/main.py +++ b/src/rookify/modules/migrate_osd_pools/main.py @@ -32,7 +32,7 @@ def _get_filtered_osd_pools_list(self) -> List[Dict[str, Any]]: state_data = self.machine.get_preflight_state("AnalyzeCephHandler").data - osd_pool_configurations = self.ceph.get_osd_pool_configurations_from_osd_dump( + osd_pool_configurations = self.ceph.get_osd_pool_configurations_from_map( state_data["report"]["osdmap"] ) diff --git a/src/rookify/modules/migrate_osds/main.py b/src/rookify/modules/migrate_osds/main.py index b6efb86..aa743d9 100644 --- a/src/rookify/modules/migrate_osds/main.py +++ b/src/rookify/modules/migrate_osds/main.py @@ -16,7 +16,8 @@ def _get_devices_of_hosts(self) -> Dict[str, Dict[str, str]]: osd_devices: Dict[str, Dict[str, str]] = {} osd_metadata = { - str(osd_data["id"]): osd_data for osd_data in state_data["osd_metadata"] + osd_data["id"]: osd_data + for osd_data in state_data["report"]["osd_metadata"] } for osd_host, osds in state_data["node"]["ls"]["osd"].items(): diff --git a/src/rookify/modules/migrate_rgw_pools/main.py b/src/rookify/modules/migrate_rgw_pools/main.py index e3076e9..7e147c1 100644 --- a/src/rookify/modules/migrate_rgw_pools/main.py +++ b/src/rookify/modules/migrate_rgw_pools/main.py @@ -37,7 +37,7 @@ def preflight(self) -> None: else: zones[zone_name] = {"osd_pools": {}, "rgw_count": 1} - osd_pools = self.ceph.get_osd_pool_configurations_from_osd_dump( + osd_pools = self.ceph.get_osd_pool_configurations_from_map( state_data["report"]["osdmap"] ) diff --git a/src/rookify/modules/migrate_rgws/main.py b/src/rookify/modules/migrate_rgws/main.py index caf7309..fc11c55 100644 --- a/src/rookify/modules/migrate_rgws/main.py +++ b/src/rookify/modules/migrate_rgws/main.py @@ -13,13 +13,19 @@ class MigrateRgwsHandler(ModuleHandler): def _get_rgw_daemon_hosts(self) -> List[str]: state_data = self.machine.get_preflight_state("AnalyzeCephHandler").data - rgw_daemons = state_data["report"]["servicemap"]["services"]["rgw"]["daemons"] + return self._get_rgw_daemon_hosts_of_map( + state_data["report"]["servicemap"]["services"]["rgw"]["daemons"] + ) + + def _get_rgw_daemon_hosts_of_map( + self, rgw_daemons_map: Dict[str, Any] + ) -> List[str]: rgw_daemon_hosts = [] - if "summary" in rgw_daemons: - del rgw_daemons["summary"] + if "summary" in rgw_daemons_map: + del rgw_daemons_map["summary"] - for rgw_daemon in rgw_daemons.values(): + for rgw_daemon in rgw_daemons_map.values(): if "metadata" not in rgw_daemon or "hostname" not in rgw_daemon["metadata"]: raise ModuleException( "Unexpected ceph-rgw daemon metadata: {0}".format(rgw_daemon) @@ -89,7 +95,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 not in rgw_daemon_hosts: break