From 074225bee11743f1af6bf2c23af97bd9e3a632b2 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 25 Feb 2020 13:45:26 -0600 Subject: [PATCH] mgr/cephadm: add misc info messages for major events Signed-off-by: Sage Weil --- src/pybind/mgr/cephadm/module.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index 360ebe3230b..49d7376723d 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -1154,6 +1154,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule): if inbuf is None or len(inbuf) == 0: return -errno.EINVAL, "", "empty ssh config provided" self.set_store("ssh_config", inbuf) + self.log.info('Set ssh_config') return 0, "", "" @orchestrator._cli_write_command( @@ -1165,6 +1166,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule): """ self.set_store("ssh_config", None) self.ssh_config_tmp = None + self.log.info('Cleared ssh_config') return 0, "", "" @orchestrator._cli_write_command( @@ -1202,6 +1204,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule): self.set_store('ssh_identity_key', None) self.set_store('ssh_identity_pub', None) self._reconfig_ssh() + self.log.info('Cleared cluster SSH key') return 0, '', '' @orchestrator._cli_read_command( @@ -1412,6 +1415,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule): self._save_inventory() self.cache.prime_empty_host(spec.hostname) self.event.set() # refresh stray health check + self.log.info('Added host %s' % spec.hostname) return "Added host '{}'".format(spec.hostname) @async_completion @@ -1427,6 +1431,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule): self.cache.rm_host(host) self._reset_con(host) self.event.set() # refresh stray health check + self.log.info('Removed host %s' % host) return "Removed host '{}'".format(host) @async_completion @@ -1437,6 +1442,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule): self._save_inventory() self._reset_con(host) self.event.set() # refresh stray health check + self.log.info('Set host %s addr to %s' % (host, addr)) return "Updated host '{}' addr to '{}'".format(host, addr) @trivial_completion @@ -1468,6 +1474,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule): if label not in self.inventory[host]['labels']: self.inventory[host]['labels'].append(label) self._save_inventory() + self.log.info('Added label %s to host %s' % (label, host)) return 'Added label %s to host %s' % (label, host) @async_completion @@ -1480,6 +1487,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule): if label in self.inventory[host]['labels']: self.inventory[host]['labels'].remove(label) self._save_inventory() + self.log.info('Removed label %s to host %s' % (label, host)) return 'Removed label %s from host %s' % (label, host) def _refresh_host_daemons(self, host): @@ -1607,6 +1615,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule): if not args: raise orchestrator.OrchestratorError( 'Unable to find %s.%s.* daemon(s)' % (service_name)) + self.log.info('%s service %s' % (action, service_name)) return self._daemon_action(args) @async_map_completion @@ -1633,9 +1642,6 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule): return "{} {} from host '{}'".format(action, name, host) def daemon_action(self, action, daemon_type, daemon_id): - self.log.debug('daemon_action action %s type %s id %s' % ( - action, daemon_type, daemon_id)) - args = [] for host, dm in self.cache.daemons.items(): for name, d in dm.items(): @@ -1646,6 +1652,8 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule): raise orchestrator.OrchestratorError( 'Unable to find %s.%s daemon(s)' % ( daemon_type, daemon_id)) + self.log.info('%s daemons %s' % (action, + ['%s.%s' % (a[0], a[1]) for a in args])) return self._daemon_action(args) def remove_daemons(self, names, force): @@ -1657,6 +1665,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule): args.append((name, host, force)) if not args: raise OrchestratorError('Unable to find daemon(s) %s' % (names)) + self.log.info('Remove daemons %s' % [a[0] for a in args]) return self._remove_daemon(args) def remove_service(self, service_name): @@ -1665,11 +1674,13 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule): for name, d in dm.items(): if d.matches_service(service_name): args.append( - ('%s.%s' % (d.daemon_type, d.daemon_id), d.hostname) + (d.name(), d.hostname) ) if not args: raise OrchestratorError('Unable to find daemons in %s service' % ( service_name)) + self.log.info('Remove service %s (daemons %s)' % ( + service_name, [a[0] for a in args])) return self._remove_daemon(args) def get_inventory(self, host_filter=None, refresh=False): @@ -1699,6 +1710,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule): return trivial_result(result) def zap_device(self, host, path): + self.log.info('Zap device %s:%s' % (host, path)) out, err, code = self._run_cephadm( host, 'osd', 'ceph-volume', ['--', 'lvm', 'zap', '--destroy', path], @@ -1725,6 +1737,8 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule): raise RuntimeError( 'Unable to affect %s light for %s:%s. Command: %s' % ( ident_fault, host, dev, ' '.join(cmd))) + self.log.info('Set %s light for %s:%s %s' % ( + ident_fault, host, dev, 'on' if on else 'off')) return "Set %s light for %s:%s %s" % ( ident_fault, host, dev, 'on' if on else 'off') -- 2.39.5