From: Sage Weil Date: Tue, 18 Feb 2020 15:16:31 +0000 (-0600) Subject: mgr/cephadm: rename DaemonCache methods etc to generalize X-Git-Tag: v15.1.1~355^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f82f8f100d21f4e07653c25f52850e49ec08d0ea;p=ceph.git mgr/cephadm: rename DaemonCache methods etc to generalize The HostCache is going to store both daemon and device state. Signed-off-by: Sage Weil --- diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index 6a4d23dbcf93..02394ddc219d 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -57,7 +57,7 @@ DEFAULT_SSH_CONFIG = ('Host *\n' DATEFMT = '%Y-%m-%dT%H:%M:%S.%f' -DAEMON_CACHE_PREFIX = "host.daemons." +HOST_CACHE_PREFIX = "host." # for py2 compat try: @@ -106,83 +106,83 @@ def assert_valid_host(name): raise OrchestratorError(e) -class DaemonCache(): +class HostCache(): def __init__(self, mgr): # type: (CephadmOrchestrator) -> None self.mgr = mgr - self.data = {} # type: Dict[str, Dict[str, orchestrator.DaemonDescription]] - self.last_update = {} # type: Dict[str, datetime.datetime] + self.daemons = {} # type: Dict[str, Dict[str, orchestrator.DaemonDescription]] + self.last_daemon_update = {} # type: Dict[str, datetime.datetime] def load(self): # type: () -> None - for k, v in six.iteritems(self.mgr.get_store_prefix(DAEMON_CACHE_PREFIX)): - host = k[len(DAEMON_CACHE_PREFIX):] + for k, v in six.iteritems(self.mgr.get_store_prefix(HOST_CACHE_PREFIX)): + host = k[len(HOST_CACHE_PREFIX):] if host not in self.mgr.inventory: - self.mgr.log.warning('removing stray DaemonCache host record %s' % ( + self.mgr.log.warning('removing stray HostCache host record %s' % ( host)) self.mgr.set_store(k, None) try: j = json.loads(v) - # we do ignore the persisted last_update to trigger a new + # we do ignore the persisted last_*_update to trigger a new # scrape on mgr restart - self.data[host] = {} + self.daemons[host] = {} for name, d in j.get('daemons', {}).items(): - self.data[host][name] = \ + self.daemons[host][name] = \ orchestrator.DaemonDescription.from_json(d) - self.mgr.log.debug('DaemonCache.load: host %s has %d daemons' % ( - host, len(self.data[host]))) + self.mgr.log.debug('HostCache.load: host %s has %d daemons' % ( + host, len(self.daemons[host]))) except Exception as e: self.mgr.log.warning('unable to load cached state for %s: %s' % ( host, e)) pass - def update_host(self, host, dm): + def update_host_daemons(self, host, dm): # type: (str, Dict[str, orchestrator.DaemonDescription]) -> None - self.data[host] = dm - self.last_update[host] = datetime.datetime.utcnow() + self.daemons[host] = dm + self.last_daemon_update[host] = datetime.datetime.utcnow() def prime_empty_host(self, host): # type: (str) -> None """ Install an empty entry for a host """ - self.data[host] = {} + self.daemons[host] = {} - def invalidate_host(self, host): + def invalidate_host_daemons(self, host): # type: (str) -> None - if host in self.last_update: - del self.last_update[host] + if host in self.last_daemon_update: + del self.last_daemon_update[host] def save_host(self, host): # type: (str) -> None j = { # type: ignore 'daemons': {}, } - if host in self.last_update: - j['last_update'] = self.last_update[host].strftime(DATEFMT) # type: ignore - for name, dd in self.data[host].items(): + if host in self.last_daemon_update: + j['last_daemon_update'] = self.last_daemon_update[host].strftime(DATEFMT) # type: ignore + for name, dd in self.daemons[host].items(): j['daemons'][name] = dd.to_json() - self.mgr.set_store(DAEMON_CACHE_PREFIX + host, json.dumps(j)) + self.mgr.set_store(HOST_CACHE_PREFIX + host, json.dumps(j)) def rm_host(self, host): # type: (str) -> None - if host in self.data: - del self.data[host] - if host in self.last_update: - del self.last_update[host] - self.mgr.set_store(DAEMON_CACHE_PREFIX + host, None) + if host in self.daemons: + del self.daemons[host] + if host in self.last_daemon_update: + del self.last_daemon_update[host] + self.mgr.set_store(HOST_CACHE_PREFIX + host, None) def get_hosts(self): # type: () -> List[str] r = [] - for host, di in self.data.items(): + for host, di in self.daemons.items(): r.append(host) return r def get_daemons(self): # type: () -> List[orchestrator.DaemonDescription] r = [] - for host, dm in self.data.items(): + for host, dm in self.daemons.items(): for name, dd in dm.items(): r.append(dd) return r @@ -190,7 +190,7 @@ class DaemonCache(): def get_daemons_by_type(self, daemon_type): # type: (str) -> List[orchestrator.DaemonDescription] result = [] # type: List[orchestrator.DaemonDescription] - for host, dm in self.data.items(): + for host, dm in self.daemons.items(): for name, d in dm.items(): if name.startswith(daemon_type + '.'): result.append(d) @@ -199,28 +199,28 @@ class DaemonCache(): def get_daemon_names(self): # type: () -> List[str] r = [] - for host, dm in self.data.items(): + for host, dm in self.daemons.items(): for name, dd in dm.items(): r.append(name) return r - def host_needs_refresh(self, host): + def host_needs_daemon_refresh(self, host): # type: (str) -> bool cutoff = datetime.datetime.utcnow() - datetime.timedelta( seconds=self.mgr.daemon_cache_timeout) - if host not in self.last_update or self.last_update[host] < cutoff: + if host not in self.last_daemon_update or self.last_daemon_update[host] < cutoff: return True return False def add_daemon(self, host, dd): # type: (str, orchestrator.DaemonDescription) -> None - assert host in self.data - self.data[host][dd.name()] = dd + assert host in self.daemons + self.daemons[host][dd.name()] = dd def rm_daemon(self, host, name): - if host in self.data: - if name in self.data[host]: - del self.data[host][name] + if host in self.daemons: + if name in self.daemons[host]: + del self.daemons[host][name] class AsyncCompletion(orchestrator.Completion): @@ -509,23 +509,23 @@ class CephadmOrchestrator(MgrModule, orchestrator.OrchestratorClientMixin): self.inventory_cache = orchestrator.OutdatablePersistentDict( self, self._STORE_HOST_PREFIX + '.devices') - self.daemon_cache = DaemonCache(self) - self.daemon_cache.load() + self.cache = HostCache(self) + self.cache.load() # ensure the host lists are in sync for h in self.inventory.keys(): if h not in self.inventory_cache: self.log.debug('adding inventory item for %s' % h) self.inventory_cache[h] = orchestrator.OutdatableData() - if h not in self.daemon_cache.data: + if h not in self.cache.daemons: self.log.debug('adding service item for %s' % h) - self.daemon_cache.prime_empty_host(h) + self.cache.prime_empty_host(h) for h in self.inventory_cache: if h not in self.inventory: del self.inventory_cache[h] - for h in self.daemon_cache.get_hosts(): + for h in self.cache.get_hosts(): if h not in self.inventory: - self.daemon_cache.rm_host(h) + self.cache.rm_host(h) def shutdown(self): self.log.info('shutdown') @@ -618,7 +618,7 @@ class CephadmOrchestrator(MgrModule, orchestrator.OrchestratorClientMixin): if opt['name'] == 'container_image': image_settings[opt['section']] = opt['value'] - daemons = self.daemon_cache.get_daemons() + daemons = self.cache.get_daemons() for daemon_type in ['mgr', 'mon', 'osd', 'rgw', 'mds']: self.log.info('Upgrade: Checking %s daemons...' % daemon_type) @@ -817,7 +817,7 @@ class CephadmOrchestrator(MgrModule, orchestrator.OrchestratorClientMixin): del self.health_checks[k] if self.warn_on_stray_hosts or self.warn_on_stray_daemons: ls = self.list_servers() - managed = self.daemon_cache.get_daemon_names() + managed = self.cache.get_daemon_names() host_detail = [] # type: List[str] host_num_daemons = 0 daemon_detail = [] # type: List[str] @@ -871,8 +871,8 @@ class CephadmOrchestrator(MgrModule, orchestrator.OrchestratorClientMixin): # refresh daemons self.log.debug('refreshing daemons') failures = [] - for host in self.daemon_cache.get_hosts(): - if self.daemon_cache.host_needs_refresh(host): + for host in self.cache.get_hosts(): + if self.cache.host_needs_daemon_refresh(host): self.log.debug('refreshing %s' % host) r = self._refresh_host_daemons(host) if r: @@ -1305,7 +1305,7 @@ class CephadmOrchestrator(MgrModule, orchestrator.OrchestratorClientMixin): } self._save_inventory() self.inventory_cache[spec.hostname] = orchestrator.OutdatableData() - self.daemon_cache.prime_empty_host(spec.hostname) + self.cache.prime_empty_host(spec.hostname) self.event.set() # refresh stray health check return "Added host '{}'".format(spec.hostname) @@ -1320,7 +1320,7 @@ class CephadmOrchestrator(MgrModule, orchestrator.OrchestratorClientMixin): del self.inventory[host] self._save_inventory() del self.inventory_cache[host] - self.daemon_cache.rm_host(host) + self.cache.rm_host(host) self._reset_con(host) self.event.set() # refresh stray health check return "Removed host '{}'".format(host) @@ -1424,7 +1424,7 @@ class CephadmOrchestrator(MgrModule, orchestrator.OrchestratorClientMixin): sd.status = None dm[sd.name()] = sd self.log.debug('Refreshed host %s daemons: %s' % (host, dm)) - self.daemon_cache.update_host(host, dm) + self.cache.update_host_daemons(host, dm) return None @@ -1435,7 +1435,7 @@ class CephadmOrchestrator(MgrModule, orchestrator.OrchestratorClientMixin): for host, hi in self.inventory.items(): self._refresh_host_daemons(host) sm = {} # type: Dict[str, orchestrator.ServiceDescription] - for h, dm in self.daemon_cache.data.items(): + for h, dm in self.cache.daemons.items(): for name, dd in dm.items(): if service_type and service_type != dd.daemon_type: continue @@ -1470,7 +1470,7 @@ class CephadmOrchestrator(MgrModule, orchestrator.OrchestratorClientMixin): for host, hi in self.inventory.items(): self._refresh_host_daemons(host) result = [] - for h, dm in self.daemon_cache.data.items(): + for h, dm in self.cache.daemons.items(): if host and h != host: continue for name, dd in dm.items(): @@ -1486,7 +1486,7 @@ class CephadmOrchestrator(MgrModule, orchestrator.OrchestratorClientMixin): self.log.debug('service_action action %s name %s' % ( action, service_name)) args = [] - for host, dm in self.daemon_cache.data.items(): + for host, dm in self.cache.daemons.items(): for name, d in dm.items(): if d.matches_service(service_name): args.append((d.daemon_type, d.daemon_id, @@ -1516,7 +1516,7 @@ class CephadmOrchestrator(MgrModule, orchestrator.OrchestratorClientMixin): host, name, 'unit', ['--name', name, a], error_ok=True) - self.daemon_cache.invalidate_host(host) + self.cache.invalidate_host_daemons(host) self.log.debug('_daemon_action code %s out %s' % (code, out)) return "{} {} from host '{}'".format(action, name, host) @@ -1525,7 +1525,7 @@ class CephadmOrchestrator(MgrModule, orchestrator.OrchestratorClientMixin): action, daemon_type, daemon_id)) args = [] - for host, dm in self.daemon_cache.data.items(): + for host, dm in self.cache.daemons.items(): for name, d in dm.items(): if d.daemon_type == daemon_type and d.daemon_id == daemon_id: args.append((d.daemon_type, d.daemon_id, @@ -1539,7 +1539,7 @@ class CephadmOrchestrator(MgrModule, orchestrator.OrchestratorClientMixin): def remove_daemons(self, names, force): # type: (List[str], bool) -> orchestrator.Completion args = [] - for host, dm in self.daemon_cache.data.items(): + for host, dm in self.cache.daemons.items(): for name in names: if name in dm: args.append((name, host, force)) @@ -1549,7 +1549,7 @@ class CephadmOrchestrator(MgrModule, orchestrator.OrchestratorClientMixin): def remove_service(self, service_name): args = [] - for host, dm in self.daemon_cache.data.items(): + for host, dm in self.cache.daemons.items(): for name, d in dm.items(): if d.matches_service(service_name): args.append( @@ -1811,7 +1811,7 @@ class CephadmOrchestrator(MgrModule, orchestrator.OrchestratorClientMixin): ] + extra_args, stdin=j) self.log.debug('create_daemon code %s out %s' % (code, out)) - if not code and host in self.daemon_cache.data: + if not code and host in self.cache.daemons: # prime cached service state with what we (should have) # just created sd = orchestrator.DaemonDescription() @@ -1820,8 +1820,8 @@ class CephadmOrchestrator(MgrModule, orchestrator.OrchestratorClientMixin): sd.nodename = host sd.status = 1 sd.status_desc = 'starting' - self.daemon_cache.add_daemon(host, sd) - self.daemon_cache.invalidate_host(host) + self.cache.add_daemon(host, sd) + self.cache.invalidate_host_daemons(host) self.event.set() return "{} {} on host '{}'".format( 'Reconfigured' if reconfig else 'Deployed', name, host) @@ -1840,12 +1840,12 @@ class CephadmOrchestrator(MgrModule, orchestrator.OrchestratorClientMixin): self.log.debug('_remove_daemon code %s out %s' % (code, out)) if not code: # remove item from cache - self.daemon_cache.rm_daemon(host, name) - self.daemon_cache.invalidate_host(host) + self.cache.rm_daemon(host, name) + self.cache.invalidate_host_daemons(host) return "Removed {} from host '{}'".format(name, host) def _update_service(self, daemon_type, add_func, spec): - daemons = self.daemon_cache.get_daemons_by_type(daemon_type) + daemons = self.cache.get_daemons_by_type(daemon_type) if len(daemons) > spec.count: # remove some to_remove = len(daemons) - spec.count @@ -1863,7 +1863,7 @@ class CephadmOrchestrator(MgrModule, orchestrator.OrchestratorClientMixin): daemon_type: str, spec: orchestrator.ServiceSpec, create_func: Callable): - daemons = self.daemon_cache.get_daemons_by_type(daemon_type) + daemons = self.cache.get_daemons_by_type(daemon_type) args = [] num_added = 0 assert spec.count is not None @@ -1933,7 +1933,7 @@ class CephadmOrchestrator(MgrModule, orchestrator.OrchestratorClientMixin): # current support requires a network to be specified orchestrator.servicespec_validate_hosts_have_network_spec(spec) - daemons = self.daemon_cache.get_daemons_by_type('mon') + daemons = self.cache.get_daemons_by_type('mon') for _, _, name in spec.placement.hosts: if name and len([d for d in daemons if d.daemon_id == name]): raise RuntimeError('name %s already exists', name) @@ -1981,7 +1981,7 @@ class CephadmOrchestrator(MgrModule, orchestrator.OrchestratorClientMixin): # current support requires a network to be specified orchestrator.servicespec_validate_hosts_have_network_spec(spec) - daemons = self.daemon_cache.get_daemons_by_type('mon') + daemons = self.cache.get_daemons_by_type('mon') for _, _, name in spec.placement.hosts: if name and len([d for d in daemons if d.daemon_id == name]): raise RuntimeError('name %s alrady exists', name) @@ -2027,7 +2027,7 @@ class CephadmOrchestrator(MgrModule, orchestrator.OrchestratorClientMixin): """ spec = NodeAssignment(spec=spec, get_hosts_func=self._get_hosts, service_type='mgr').load() - daemons = self.daemon_cache.get_daemons_by_type('mgr') + daemons = self.cache.get_daemons_by_type('mgr') num_mgrs = len(daemons) if spec.count == num_mgrs: return orchestrator.Completion(value="The requested number of managers exist.") @@ -2283,7 +2283,7 @@ scrape_configs: 'needs_update': dict(), 'up_to_date': list(), } - for host, dm in self.daemon_cache.data.items(): + for host, dm in self.cache.daemons.items(): for name, dd in dm.items(): if target_id == dd.container_image_id: r['up_to_date'].append(dd.name()) diff --git a/src/pybind/mgr/cephadm/tests/test_cephadm.py b/src/pybind/mgr/cephadm/tests/test_cephadm.py index f0e4796be879..092cd0c94da9 100644 --- a/src/pybind/mgr/cephadm/tests/test_cephadm.py +++ b/src/pybind/mgr/cephadm/tests/test_cephadm.py @@ -60,8 +60,8 @@ class TestCephadm(object): @mock.patch("cephadm.module.CephadmOrchestrator._get_connection") @mock.patch("cephadm.module.CephadmOrchestrator._run_cephadm", _run_cephadm('[]')) - @mock.patch("cephadm.module.DaemonCache.save_host") - @mock.patch("cephadm.module.DaemonCache.rm_host") + @mock.patch("cephadm.module.HostCache.save_host") + @mock.patch("cephadm.module.HostCache.rm_host") def test_host(self, _get_connection, _save_host, _rm_host, cephadm_module): with self._with_host(cephadm_module, 'test'): assert wait(cephadm_module, cephadm_module.get_hosts()) == [InventoryNode('test')] @@ -69,16 +69,16 @@ class TestCephadm(object): assert wait(cephadm_module, c) == [] @mock.patch("cephadm.module.CephadmOrchestrator._run_cephadm", _run_cephadm('[]')) - @mock.patch("cephadm.module.DaemonCache.save_host") - @mock.patch("cephadm.module.DaemonCache.rm_host") + @mock.patch("cephadm.module.HostCache.save_host") + @mock.patch("cephadm.module.HostCache.rm_host") def test_service_ls(self, _save_host, _rm_host, cephadm_module): with self._with_host(cephadm_module, 'test'): c = cephadm_module.list_daemons(refresh=True) assert wait(cephadm_module, c) == [] @mock.patch("cephadm.module.CephadmOrchestrator._run_cephadm", _run_cephadm('[]')) - @mock.patch("cephadm.module.DaemonCache.save_host") - @mock.patch("cephadm.module.DaemonCache.rm_host") + @mock.patch("cephadm.module.HostCache.save_host") + @mock.patch("cephadm.module.HostCache.rm_host") def test_device_ls(self, _save_host, _rm_host, cephadm_module): with self._with_host(cephadm_module, 'test'): c = cephadm_module.get_inventory() @@ -99,8 +99,8 @@ class TestCephadm(object): @mock.patch("cephadm.module.CephadmOrchestrator.send_command") @mock.patch("cephadm.module.CephadmOrchestrator.mon_command", mon_command) @mock.patch("cephadm.module.CephadmOrchestrator._get_connection") - @mock.patch("cephadm.module.DaemonCache.save_host") - @mock.patch("cephadm.module.DaemonCache.rm_host") + @mock.patch("cephadm.module.HostCache.save_host") + @mock.patch("cephadm.module.HostCache.rm_host") def test_daemon_action(self, _send_command, _get_connection, _save_host, _rm_host, cephadm_module): cephadm_module.service_cache_timeout = 10 with self._with_host(cephadm_module, 'test'): @@ -118,8 +118,8 @@ class TestCephadm(object): @mock.patch("cephadm.module.CephadmOrchestrator.send_command") @mock.patch("cephadm.module.CephadmOrchestrator.mon_command", mon_command) @mock.patch("cephadm.module.CephadmOrchestrator._get_connection") - @mock.patch("cephadm.module.DaemonCache.save_host") - @mock.patch("cephadm.module.DaemonCache.rm_host") + @mock.patch("cephadm.module.HostCache.save_host") + @mock.patch("cephadm.module.HostCache.rm_host") def test_mon_update(self, _send_command, _get_connection, _save_host, _rm_host, cephadm_module): with self._with_host(cephadm_module, 'test'): ps = PlacementSpec(hosts=['test:0.0.0.0=a'], count=1) @@ -135,8 +135,8 @@ class TestCephadm(object): @mock.patch("cephadm.module.CephadmOrchestrator.send_command") @mock.patch("cephadm.module.CephadmOrchestrator.mon_command", mon_command) @mock.patch("cephadm.module.CephadmOrchestrator._get_connection") - @mock.patch("cephadm.module.DaemonCache.save_host") - @mock.patch("cephadm.module.DaemonCache.rm_host") + @mock.patch("cephadm.module.HostCache.save_host") + @mock.patch("cephadm.module.HostCache.rm_host") def test_mgr_update(self, _send_command, _get_connection, _save_host, _rm_host, cephadm_module): with self._with_host(cephadm_module, 'test'): ps = PlacementSpec(hosts=['test:0.0.0.0=a'], count=1) @@ -149,8 +149,8 @@ class TestCephadm(object): @mock.patch("cephadm.module.CephadmOrchestrator.send_command") @mock.patch("cephadm.module.CephadmOrchestrator.mon_command", mon_command) @mock.patch("cephadm.module.CephadmOrchestrator._get_connection") - @mock.patch("cephadm.module.DaemonCache.save_host") - @mock.patch("cephadm.module.DaemonCache.rm_host") + @mock.patch("cephadm.module.HostCache.save_host") + @mock.patch("cephadm.module.HostCache.rm_host") def test_create_osds(self, _send_command, _get_connection, _save_host, _rm_host, cephadm_module): with self._with_host(cephadm_module, 'test'): dg = DriveGroupSpec('test', data_devices=DeviceSelection(paths=[''])) @@ -169,8 +169,8 @@ class TestCephadm(object): ) ]) )) - @mock.patch("cephadm.module.DaemonCache.save_host") - @mock.patch("cephadm.module.DaemonCache.rm_host") + @mock.patch("cephadm.module.HostCache.save_host") + @mock.patch("cephadm.module.HostCache.rm_host") def test_remove_osds(self, _save_host, _rm_host, cephadm_module): with self._with_host(cephadm_module, 'test'): c = cephadm_module.list_daemons(refresh=True) @@ -183,8 +183,8 @@ class TestCephadm(object): @mock.patch("cephadm.module.CephadmOrchestrator.send_command") @mock.patch("cephadm.module.CephadmOrchestrator.mon_command", mon_command) @mock.patch("cephadm.module.CephadmOrchestrator._get_connection") - @mock.patch("cephadm.module.DaemonCache.save_host") - @mock.patch("cephadm.module.DaemonCache.rm_host") + @mock.patch("cephadm.module.HostCache.save_host") + @mock.patch("cephadm.module.HostCache.rm_host") def test_mds(self, _send_command, _get_connection, _save_host, _rm_host, cephadm_module): with self._with_host(cephadm_module, 'test'): ps = PlacementSpec(hosts=['test'], count=1) @@ -196,8 +196,8 @@ class TestCephadm(object): @mock.patch("cephadm.module.CephadmOrchestrator.send_command") @mock.patch("cephadm.module.CephadmOrchestrator.mon_command", mon_command) @mock.patch("cephadm.module.CephadmOrchestrator._get_connection") - @mock.patch("cephadm.module.DaemonCache.save_host") - @mock.patch("cephadm.module.DaemonCache.rm_host") + @mock.patch("cephadm.module.HostCache.save_host") + @mock.patch("cephadm.module.HostCache.rm_host") def test_rgw(self, _send_command, _get_connection, _save_host, _rm_host, cephadm_module): with self._with_host(cephadm_module, 'test'): @@ -211,8 +211,8 @@ class TestCephadm(object): @mock.patch("cephadm.module.CephadmOrchestrator.send_command") @mock.patch("cephadm.module.CephadmOrchestrator.mon_command", mon_command) @mock.patch("cephadm.module.CephadmOrchestrator._get_connection") - @mock.patch("cephadm.module.DaemonCache.save_host") - @mock.patch("cephadm.module.DaemonCache.rm_host") + @mock.patch("cephadm.module.HostCache.save_host") + @mock.patch("cephadm.module.HostCache.rm_host") def test_rgw_update(self, _send_command, _get_connection, _save_host, _rm_host, cephadm_module): with self._with_host(cephadm_module, 'host1'): @@ -231,8 +231,8 @@ class TestCephadm(object): @mock.patch("cephadm.module.CephadmOrchestrator.send_command") @mock.patch("cephadm.module.CephadmOrchestrator.mon_command", mon_command) @mock.patch("cephadm.module.CephadmOrchestrator._get_connection") - @mock.patch("cephadm.module.DaemonCache.save_host") - @mock.patch("cephadm.module.DaemonCache.rm_host") + @mock.patch("cephadm.module.HostCache.save_host") + @mock.patch("cephadm.module.HostCache.rm_host") def test_rgw_update_fail(self, _send_command, _get_connection, _save_host, _rm_host, cephadm_module): with self._with_host(cephadm_module, 'host1'): @@ -269,8 +269,8 @@ class TestCephadm(object): ) ]) )) - @mock.patch("cephadm.module.DaemonCache.save_host") - @mock.patch("cephadm.module.DaemonCache.rm_host") + @mock.patch("cephadm.module.HostCache.save_host") + @mock.patch("cephadm.module.HostCache.rm_host") def test_remove_daemon(self, _save_host, _rm_host, cephadm_module): with self._with_host(cephadm_module, 'test'): c = cephadm_module.list_daemons(refresh=True) @@ -291,8 +291,8 @@ class TestCephadm(object): ) ]) )) - @mock.patch("cephadm.module.DaemonCache.save_host") - @mock.patch("cephadm.module.DaemonCache.rm_host") + @mock.patch("cephadm.module.HostCache.save_host") + @mock.patch("cephadm.module.HostCache.rm_host") def test_remove_service(self, _save_host, _rm_host, cephadm_module): with self._with_host(cephadm_module, 'test'): c = cephadm_module.list_daemons(refresh=True) @@ -305,8 +305,8 @@ class TestCephadm(object): @mock.patch("cephadm.module.CephadmOrchestrator.send_command") @mock.patch("cephadm.module.CephadmOrchestrator.mon_command", mon_command) @mock.patch("cephadm.module.CephadmOrchestrator._get_connection") - @mock.patch("cephadm.module.DaemonCache.save_host") - @mock.patch("cephadm.module.DaemonCache.rm_host") + @mock.patch("cephadm.module.HostCache.save_host") + @mock.patch("cephadm.module.HostCache.rm_host") def test_rbd_mirror(self, _send_command, _get_connection, _save_host, _rm_host, cephadm_module): # type: (mock.Mock, mock.Mock, mock.Mock, mock.Mock, CephadmOrchestrator) -> None with self._with_host(cephadm_module, 'test'): @@ -320,8 +320,8 @@ class TestCephadm(object): @mock.patch("cephadm.module.CephadmOrchestrator.send_command") @mock.patch("cephadm.module.CephadmOrchestrator.mon_command", mon_command) @mock.patch("cephadm.module.CephadmOrchestrator._get_connection") - @mock.patch("cephadm.module.DaemonCache.save_host") - @mock.patch("cephadm.module.DaemonCache.rm_host") + @mock.patch("cephadm.module.HostCache.save_host") + @mock.patch("cephadm.module.HostCache.rm_host") def test_prometheus(self, _send_command, _get_connection, _save_host, _rm_host, cephadm_module): with self._with_host(cephadm_module, 'test'): ps = PlacementSpec(hosts=['test'], count=1) @@ -334,8 +334,8 @@ class TestCephadm(object): @mock.patch("cephadm.module.CephadmOrchestrator.send_command") @mock.patch("cephadm.module.CephadmOrchestrator.mon_command", mon_command) @mock.patch("cephadm.module.CephadmOrchestrator._get_connection") - @mock.patch("cephadm.module.DaemonCache.save_host") - @mock.patch("cephadm.module.DaemonCache.rm_host") + @mock.patch("cephadm.module.HostCache.save_host") + @mock.patch("cephadm.module.HostCache.rm_host") def test_node_exporter(self, _send_command, _get_connection, _save_host, _rm_host, cephadm_module): # type: (mock.Mock, mock.Mock, mock.Mock, mock.Mock, CephadmOrchestrator) -> None with self._with_host(cephadm_module, 'test'): @@ -349,8 +349,8 @@ class TestCephadm(object): @mock.patch("cephadm.module.CephadmOrchestrator.send_command") @mock.patch("cephadm.module.CephadmOrchestrator.mon_command", mon_command) @mock.patch("cephadm.module.CephadmOrchestrator._get_connection") - @mock.patch("cephadm.module.DaemonCache.save_host") - @mock.patch("cephadm.module.DaemonCache.rm_host") + @mock.patch("cephadm.module.HostCache.save_host") + @mock.patch("cephadm.module.HostCache.rm_host") def test_blink_device_light(self, _send_command, _get_connection, _save_host, _rm_host, cephadm_module): with self._with_host(cephadm_module, 'test'): c = cephadm_module.blink_device_light('ident', True, [('test', '', '')])