]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: preserve original hostnames where required 70346/head
authorShubha Jain <SHUBHA.JAIN1@ibm.com>
Thu, 30 Jul 2026 09:24:06 +0000 (14:54 +0530)
committerShubha Jain <SHUBHA.JAIN1@ibm.com>
Thu, 30 Jul 2026 09:24:06 +0000 (14:54 +0530)
Retain the original hostname for CRUSH removal operations so the
commands continue to match existing CRUSH bucket names after hostname
normalization.

Also normalize DaemonDescription.hostname when loading the persisted
host cache to ensure scheduler hostname comparisons remain consistent
with normalized inventory and HostCache entries.

Fixes: https://tracker.ceph.com/issues/78426
Signed-off-by: Shubha Jain <SHUBHA.JAIN1@ibm.com>
src/pybind/mgr/cephadm/inventory.py
src/pybind/mgr/cephadm/module.py

index 7af5ae28c36525cd1861e15c16bf89f422fcb217..f34d3ebc8e1b60d2fc2a9820b063cd66b16b3c6a 100644 (file)
@@ -946,8 +946,9 @@ class HostCache():
                         j.get('networks_and_interfaces', {}))
 
                 for name, d in j.get('daemons', {}).items():
-                    self.daemons[host][name] = \
-                        orchestrator.DaemonDescription.from_json(d)
+                    dd = orchestrator.DaemonDescription.from_json(d)
+                    dd.hostname = host
+                    self.daemons[host][name] = dd
                 # still want to check old device location for upgrade scenarios
                 for d in j.get('devices', []):
                     self.devices[host].append(inventory.Device.from_json(d))
index 3f1c8607eeba0df2fde15b8542ff119949bb436a..269f4148808084ad2403e25edea851dbcd4a6c05 100644 (file)
@@ -2358,6 +2358,7 @@ Then run the following:
         :param force: bypass running daemons check
         :param offline: remove offline host
         """
+        original_host = host
         host = normalize_hostname(host)
 
         # check if host is offline
@@ -2427,7 +2428,7 @@ Then run the following:
 
             cmd_args = {
                 'prefix': 'osd crush rm',
-                'name': host
+                'name': original_host
             }
             run_cmd(cmd_args)
 
@@ -2435,7 +2436,7 @@ Then run the following:
             try:
                 self.check_mon_command({
                     'prefix': 'osd crush remove',
-                    'name': host,
+                    'name': original_host,
                 })
             except MonCommandFailed as e:
                 self.log.error(f'Couldn\'t remove host {host} from CRUSH map: {str(e)}')