From: John Mulligan Date: Mon, 9 Mar 2026 19:08:44 +0000 (-0400) Subject: mgr/cephadm: avoid redundant call to cache.get_scheduled_daemon_action X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c8a1451f1dbd48206cc243401ae4ac2a4b49c1f2;p=ceph.git mgr/cephadm: avoid redundant call to cache.get_scheduled_daemon_action Avoid a redundant call to cache.get_scheduled_daemon_action by saving the call result in two variables at the first call site. One var may be changed but the other will retain the original value until it is checked again later. Signed-off-by: John Mulligan --- diff --git a/src/pybind/mgr/cephadm/serve.py b/src/pybind/mgr/cephadm/serve.py index b3e970273d73..ecc3ce91d732 100644 --- a/src/pybind/mgr/cephadm/serve.py +++ b/src/pybind/mgr/cephadm/serve.py @@ -1152,7 +1152,11 @@ class CephadmServe: dd.hostname, dd.name()) if last_deps is None: last_deps = [] - action = self.mgr.cache.get_scheduled_daemon_action(dd.hostname, dd.name()) + action = scheduled_action = ( + self.mgr.cache.get_scheduled_daemon_action( + dd.hostname, dd.name() + ) + ) if not last_config: self.log.info('Reconfiguring %s (unknown last config time)...' % ( dd.name())) @@ -1209,8 +1213,7 @@ class CephadmServe: action = 'reconfig' if action: - if self.mgr.cache.get_scheduled_daemon_action(dd.hostname, dd.name()) == 'redeploy' \ - and action == 'reconfig': + if scheduled_action == 'redeploy' and action == 'reconfig': action = 'redeploy' try: daemon_spec = CephadmDaemonDeploySpec.from_daemon_description(dd)