]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/ssh: pass daemon id separately to _create_daemon
authorSage Weil <sage@redhat.com>
Tue, 1 Oct 2019 19:15:47 +0000 (14:15 -0500)
committerSage Weil <sage@redhat.com>
Sat, 5 Oct 2019 01:33:35 +0000 (20:33 -0500)
Don't assume it is the hostname (with osds, it's not!).

Also, just pass arbitrary args down, instead of special-casing the
network option.

Signed-off-by: Sage Weil <sage@redhat.com>
src/pybind/mgr/ssh/module.py

index 1b5b8b4b3b5db367bf58187a8cba31a9a09c6b75..49cb68b05bbd3b763d7fc4379a9801d93d1072cc 100644 (file)
@@ -552,10 +552,11 @@ class SSHOrchestrator(MgrModule, orchestrator.Orchestrator):
 
         return SSHWriteCompletion(result)
 
-    def _create_daemon(self, daemon_type, host, keyring, network=None):
+    def _create_daemon(self, daemon_type, daemon_id, host, keyring,
+                       extra_args=[]):
         conn = self._get_connection(host)
         try:
-            name = '%s.%s' % (daemon_type, host)
+            name = '%s.%s' % (daemon_type, daemon_id)
 
             # generate config
             ret, config, err = self.mon_command({
@@ -574,15 +575,13 @@ class SSHOrchestrator(MgrModule, orchestrator.Orchestrator):
                 j,
                 0o600, None, 0, 0)
 
-            extra_args = []
-            if network:
-                extra_args += ['--mon-network', network]
-            self._run_ceph_daemon(
+            out, code = self._run_ceph_daemon(
                 host, name, 'deploy',
                 [
                     '--name', name,
-                    '--config-and-keyring', '/tmp/foo'
+                    '--config-and-keyring', '/tmp/foo',
                 ] + extra_args)
+            self.log.debug('create_daemon code %s out %s' % (code, out))
 
             return "Created {} on host '{}'".format(name, host)
 
@@ -607,7 +606,8 @@ class SSHOrchestrator(MgrModule, orchestrator.Orchestrator):
         })
         self.log.debug('mon keyring %s' % keyring)
 
-        return self._create_daemon('mon', host, keyring, network=network)
+        return self._create_daemon('mon', host, host, keyring,
+                                   extra_args=['--mon-network', network])
 
     def update_mons(self, num, hosts):
         """
@@ -665,7 +665,7 @@ class SSHOrchestrator(MgrModule, orchestrator.Orchestrator):
         })
         self.log.debug('keyring %s' % keyring)
 
-        return self._create_daemon('mgr', host, keyring)
+        return self._create_daemon('mgr', host, host, keyring)
 
     def update_mgrs(self, num, hosts):
         """