]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: agent: kick serve loop if number of daemons on host changes
authorAdam King <adking@redhat.com>
Tue, 26 Oct 2021 19:33:57 +0000 (15:33 -0400)
committerAdam King <adking@redhat.com>
Tue, 26 Oct 2021 19:36:18 +0000 (15:36 -0400)
In case something needs to be done about it in serve loop
e.g. redeploying a daemon that has disappeared.

Signed-off-by: Adam King <adking@redhat.com>
src/pybind/mgr/cephadm/agent.py

index 1de205b71df08d2efb334bc6d346e402fce4a06a..4ee5912ad4e4bd8b05786d9eb36e8c72b07ac288 100644 (file)
@@ -174,6 +174,7 @@ class HostData:
             self.mgr.cache.agent_timestamp[host] = datetime_now()
 
             error_daemons_old = set([dd.name() for dd in self.mgr.cache.get_error_daemons()])
+            daemon_count_old = len(self.mgr.cache.get_daemons_by_host(host))
 
             agents_down = []
             for h in self.mgr.cache.get_hosts():
@@ -204,9 +205,12 @@ class HostData:
                 ret = Devices.from_json(json.loads(data['volume']))
                 self.mgr.cache.update_host_devices(host, ret.devices)
 
-            if error_daemons_old != set([dd.name() for dd in self.mgr.cache.get_error_daemons()]):
+            if (
+                error_daemons_old != set([dd.name() for dd in self.mgr.cache.get_error_daemons()])
+                or daemon_count_old != len(self.mgr.cache.get_daemons_by_host(host))
+            ):
                 self.mgr.log.info(
-                    f'Change detected in daemons in error state from {host} agent metadata. Kicking serve loop')
+                    f'Change detected in state of daemons from {host} agent metadata. Kicking serve loop')
                 self.mgr._kick_serve_loop()
 
             if up_to_date and ('ls' in data and data['ls']):