From: Daniel Pivonka Date: Tue, 30 Mar 2021 20:17:46 +0000 (-0400) Subject: mgr/cephadm: fix orch host add with multiple labels and no addr X-Git-Tag: v16.2.2~1^2~63 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c77903b2579c76f18b5828f6df2198b1f763c7b0;p=ceph.git mgr/cephadm: fix orch host add with multiple labels and no addr Signed-off-by: Daniel Pivonka (cherry picked from commit 92ad1420c848dd5406685e0d78d3b56356ed9455) --- diff --git a/doc/cephadm/host-management.rst b/doc/cephadm/host-management.rst index e91553ddcddb..eb680388d6c1 100644 --- a/doc/cephadm/host-management.rst +++ b/doc/cephadm/host-management.rst @@ -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 diff --git a/src/pybind/mgr/cephadm/serve.py b/src/pybind/mgr/cephadm/serve.py index 824f67480752..15cb8d7c3bfd 100644 --- a/src/pybind/mgr/cephadm/serve.py +++ b/src/pybind/mgr/cephadm/serve.py @@ -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) diff --git a/src/pybind/mgr/orchestrator/module.py b/src/pybind/mgr/orchestrator/module.py index 42d964ab9754..f24177064e40 100644 --- a/src/pybind/mgr/orchestrator/module.py +++ b/src/pybind/mgr/orchestrator/module.py @@ -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)