Skip to content

mgr/cephadm: fix orch host add with multiple labels and no addr - #40508

Merged
liewegas merged 1 commit into
ceph:masterfrom
Daniel-Pivonka:cephadmorchhostaddlabelsbug
Apr 5, 2021
Merged

liewegas merged 1 commit into
ceph:masterfrom
Daniel-Pivonka:cephadmorchhostaddlabelsbug

Conversation

@Daniel-Pivonka

Copy link
Copy Markdown

the first problem:
ceph orch host add provides a misleading error message if addr is not valid

switching the error message to use the addr variable will show its trying to make a connection to that address
(addr = hostname if no addr is provided)

second problem:
orch host add command can not add a host with multiple labels and no addr (its possible if you put '' in the addr positional argument)

previously using the --labels flag there was no way to specify multiple labels. everything was taken as a single large label
ex: --labels=label1,label2 would evaluate to a list of labels as ["label1,label2"]

now you can use command separated labels

ceph orch host add vm-01 --labels=label1,label2,label3
and the labels will save separately ex: ["label1","label2","labe3"]

additionally i have documented this functionality

Fixes: https://tracker.ceph.com/issues/50062
Signed-off-by: Daniel Pivonka [email protected]

@tchaikov

Copy link
Copy Markdown
Contributor

jenkins test api

@tchaikov

Copy link
Copy Markdown
Contributor
flake8 run-test-pre: PYTHONHASHSEED='3149576095'
flake8 run-test: commands[0] | flake8 --config=tox.ini alerts balancer cephadm crash devicehealth diskprediction_local hello iostat localpool orchestrator prometheus
orchestrator/module.py:330:9: E265 block comment should start with '# '
orchestrator/module.py:331:22: E271 multiple spaces after keyword
1     E265 block comment should start with '# '
1     E271 multiple spaces after keyword
ERROR: InvocationError for command /home/jenkins-build/build/workspace/ceph-pull-requests/src/pybind/mgr/.tox/flake8/bin/flake8 --

@Daniel-Pivonka
Daniel-Pivonka force-pushed the cephadmorchhostaddlabelsbug branch from 341411c to 92ad142 Compare March 31, 2021 14:16
@tchaikov

Copy link
Copy Markdown
Contributor

jenkins test make check

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ceph orch host add my_hostname --labels=my_label1,my_label2
ceph orch host add my_hostname --labels=my_label1 --labels=my_label2

should work as well.

I'm not yet sure if I should be super happy, if we introduce a new way to pass multiple labels. I think a better way would be to extend ceph_argparse to also support comma-separated lists of elements for n=N arguments. But, understandably, no one likes touching ceph_argparse.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah

@liewegas
liewegas merged commit 91eb165 into ceph:master Apr 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants