]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: hardcode daemon type to mon 66189/head
authorTimothy Q Nguyen <timqn22@gmail.com>
Fri, 14 Nov 2025 17:50:17 +0000 (09:50 -0800)
committerTimothy Q Nguyen <timqn22@gmail.com>
Wed, 4 Mar 2026 18:33:20 +0000 (10:33 -0800)
Using the service_name variable is unnecessary due to
the output always being "mon", this is a safe change as
the function immediately checks that daemon type is
"mon". I included fixes for flake8, minor log
message error, and ensuring action is redeploy.

Signed-off-by: Timothy Q Nguyen <timqn22@gmail.com>
src/pybind/mgr/cephadm/module.py

index 3df2387cd433c5676bfb1093ee6073b574230641..e94aa83010a31a5459314a062622c89a0664b2c7 100644 (file)
@@ -2671,29 +2671,29 @@ Then run the following:
             return False
 
         rc_get, out_get, err_get = self.mon_command({
-                    'prefix': 'config get',
-                    'who': f'{daemon_spec.service_name}.{daemon_spec.daemon_id}',
-                    'key': 'public_network'
-                })
+            'prefix': 'config get',
+            'who': f'mon.{daemon_spec.daemon_id}',
+            'key': 'public_network'
+        })
 
         if rc_get:
             self.log.error(f'cmd: config get failed with: {err_get}, (errno:{rc_get})')
             return False
 
         rc_show, out_show, err_show = self.mon_command({
-                    'prefix': 'config show',
-                    'who': f'{daemon_spec.service_name}.{daemon_spec.daemon_id}',
-                    'key': 'public_network'
-                })
+            'prefix': 'config show',
+            'who': f'mon.{daemon_spec.daemon_id}',
+            'key': 'public_network'
+        })
 
         if rc_show:
-            self.log.error(f'cmd: config get failed with: {err_show}, (errno:{rc_show})')
+            self.log.error(f'cmd: config show failed with: {err_show}, (errno:{rc_show})')
             return False
 
         if out_get == out_show:
             return False
 
-        self.log.debug(f'{daemon_spec.service_name}.{daemon_spec.daemon_id} public network changed, redeploy instead of restart')
+        self.log.debug(f'mon.{daemon_spec.daemon_id} public network changed, redeploy instead of restart')
         return True
 
     def _daemon_action(self,
@@ -2712,6 +2712,8 @@ Then run the following:
             return self._rotate_daemon_key(daemon_spec)
 
         if action == 'redeploy' or action == 'reconfig' or (action == 'restart' and self._mon_public_network_changed(daemon_spec)):
+            if action == 'restart':
+                action = 'redeploy'  # to ensure proper behavior since we want redeploy
             if daemon_spec.daemon_type != 'osd':
                 daemon_spec = service_registry.get_service(daemon_type_to_service(
                     daemon_spec.daemon_type)).prepare_create(daemon_spec)