Project

General

Profile

Actions

Bug #54342

closed

cephadm crashes when hostname contains an invalid char instead of showing an error

Added by Redouane Kachach Elhichou about 2 years ago. Updated about 2 years ago.

Status:
Resolved
Priority:
Normal
Category:
-
Target version:
-
% Done:

0%

Source:
Tags:
low-hanging-fruit
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

Show an error instead of crashing:

ceph orch host add my_hostname --labels=my_label1

[ceph: root@ceph-node-0 /]# ceph orch host add my_hostname --labels=my_label1
Error EINVAL: Traceback (most recent call last):
  File "/usr/share/ceph/mgr/mgr_module.py", line 1701, in _handle_command
    return self.handle_command(inbuf, cmd)
  File "/usr/share/ceph/mgr/orchestrator/_interface.py", line 171, in handle_command
    return dispatch[cmd['prefix']].call(self, cmd, inbuf)
  File "/usr/share/ceph/mgr/mgr_module.py", line 433, in call
    return self.func(mgr, **kwargs)
  File "/usr/share/ceph/mgr/orchestrator/_interface.py", line 107, in <lambda>
    wrapper_copy = lambda *l_args, **l_kwargs: wrapper(*l_args, **l_kwargs)  # noqa: E731
  File "/usr/share/ceph/mgr/orchestrator/_interface.py", line 96, in wrapper
    return func(*args, **kwargs)
  File "/usr/share/ceph/mgr/orchestrator/module.py", line 350, in _add_host
    return self._apply_misc([s], False, Format.plain)
  File "/usr/share/ceph/mgr/orchestrator/module.py", line 1046, in _apply_misc
    raise_if_exception(completion)
  File "/usr/share/ceph/mgr/orchestrator/_interface.py", line 228, in raise_if_exception
    raise e
Exception: name component must include only a-z, 0-9, and -

Actions #1

Updated by Sebastian Wagner about 2 years ago

might be due to the ServiceSpec object still belonging to the orchestrator sub interpreter thus breaking module identity in the cpehadm module. Try calling ServiceSpec.validate(spec) instead of spec.validate()

Actions #2

Updated by Redouane Kachach Elhichou about 2 years ago

  • Status changed from New to Fix Under Review
  • Assignee set to Redouane Kachach Elhichou
Actions #3

Updated by Redouane Kachach Elhichou about 2 years ago

  • Pull request ID set to 45275
Actions #4

Updated by Redouane Kachach Elhichou about 2 years ago

Thanks for the hint. Basically host spec was not validated before calling down cephadm.

Actions #5

Updated by Redouane Kachach Elhichou about 2 years ago

I changed newly the code to move the validation to cephadm. Instead of ServiceSpec.validate(spec) I had to call HostSpec.validate(spec)

Actions #6

Updated by Redouane Kachach Elhichou about 2 years ago

  • Status changed from Fix Under Review to Resolved
Actions

Also available in: Atom PDF