]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: fix orch host add with multiple labels and no addr
authorDaniel Pivonka <dpivonka@redhat.com>
Tue, 30 Mar 2021 20:17:46 +0000 (16:17 -0400)
committerSage Weil <sage@newdream.net>
Fri, 23 Apr 2021 12:24:13 +0000 (07:24 -0500)
Signed-off-by: Daniel Pivonka <dpivonka@redhat.com>
(cherry picked from commit 92ad1420c848dd5406685e0d78d3b56356ed9455)

doc/cephadm/host-management.rst
src/pybind/mgr/cephadm/serve.py
src/pybind/mgr/orchestrator/module.py

index e91553ddcddb47170ba495d07679fb7cca5eda6a..eb680388d6c15488d331c880e244dbcb0b4dda47 100644 (file)
@@ -101,7 +101,12 @@ are free form and have no particular meaning by itself and each host
 can have multiple labels. They can be used to specify placement
 of daemons. See :ref:`orch-placement-by-labels`
 
-To add a label, run::
+Labels can be added when adding a host with the ``--labels`` flag::
+
+  ceph orch host add my_hostname --labels=my_label1
+  ceph orch host add my_hostname --labels=my_label1,my_label2
+
+To add a label a existing host, run::
 
   ceph orch host label add my_hostname my_label
 
index 824f674807523bb5aaf5bb1bf0a4c9b560cdc138..15cb8d7c3bfde8c4c40763a70e60017140c062bb 100644 (file)
@@ -1187,13 +1187,13 @@ Please make sure that the host is reachable and accepts connections using the ce
 
 To add the cephadm SSH key to the host:
 > ceph cephadm get-pub-key > ~/ceph.pub
-> ssh-copy-id -f -i ~/ceph.pub {user}@{host}
+> ssh-copy-id -f -i ~/ceph.pub {user}@{addr}
 
 To check that the host is reachable:
 > ceph cephadm get-ssh-config > ssh_config
 > ceph config-key get mgr/cephadm/ssh_identity_key > ~/cephadm_private_key
 > chmod 0600 ~/cephadm_private_key
-> ssh -F ssh_config -i ~/cephadm_private_key {user}@{host}'''
+> ssh -F ssh_config -i ~/cephadm_private_key {user}@{addr}'''
             raise OrchestratorError(msg) from e
         except Exception as ex:
             self.log.exception(ex)
index 42d964ab9754c0ecb86d7cab9c79c9dbe7f42933..f24177064e401d36e896c6a1d65b3e1fd06169a1 100644 (file)
@@ -326,6 +326,11 @@ class OrchestratorCli(OrchestratorClientMixin, MgrModule,
     def _add_host(self, hostname: str, addr: Optional[str] = None, labels: Optional[List[str]] = None, maintenance: Optional[bool] = False) -> HandleCommandResult:
         """Add a host"""
         _status = 'maintenance' if maintenance else ''
+
+        # split multiple labels passed in with --labels=label1,label2
+        if labels and len(labels) == 1:
+            labels = labels[0].split(',')
+
         s = HostSpec(hostname=hostname, addr=addr, labels=labels, status=_status)
 
         return self._apply_misc([s], False, Format.plain)