Project

General

Profile

Bug #46922

cephadm: IPv6 syntax inconsistency

Added by Ricardo Marques over 3 years ago. Updated over 3 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Matthew Oliver
Category:
cephadm
Target version:
-
% Done:

0%

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

Description

While trying to bootstrap a cluster with `--mon-ip` and `--apply-spec` options I found that someting IPv6 syntax is `[<IP>]`, and sometimes is`<IP>`.

The following examples show which combinations will work:

1)

cephadm --verbose bootstrap --mon-ip fde4:8dba:82e1:0:5054:ff:fecd:3d4e --apply-spec /root/bootstrap-spec.yaml

Fails because we must use `[<IP>]` format on `--mon-ip`:

INFO:cephadm:/usr/bin/monmaptool:stderr /usr/bin/monmaptool: invalid ip:port '[v2:fde4:8dba:82e1:0:5054:ff:fecd:3d4e:3300,v1:fde4:8dba:82e1:0:5054:ff:fecd:3d4e:6789]'
Traceback (most recent call last):
  File "/usr/sbin/cephadm", line 5159, in <module>
    r = args.func()
  File "/usr/sbin/cephadm", line 1223, in _default_image
    return func()
  File "/usr/sbin/cephadm", line 2661, in command_bootstrap
    tmp_monmap.name: '/tmp/monmap:z',
  File "/usr/sbin/cephadm", line 2404, in run
    self.run_cmd(), desc=self.entrypoint, timeout=timeout)
  File "/usr/sbin/cephadm", line 884, in call_throws
    raise RuntimeError('Failed command: %s' % ' '.join(command))
RuntimeError: Failed command: /usr/bin/podman run --rm --net=host --ipc=host -e CONTAINER_IMAGE=docker.io/ceph/ceph:v15 -e NODE_NAME=node1 -v /tmp/ceph-tmpiuac2yke:/tmp/monmap:z --entrypoint /usr/bin/monmaptool docker.io/ceph/ceph:v15 --create --clobber --fsid e308bb2a-dd5f-11ea-88c2-525400ca3d18 --addv node1 [v2:fde4:8dba:82e1:0:5054:ff:fecd:3d4e:3300,v1:fde4:8dba:82e1:0:5054:ff:fecd:3d4e:6789] /tmp/monmap

2)

# cat /root/bootstrap-spec.yaml 
service_type: mgr
service_name: mgr
placement:
    hosts:
        - 'node1'
---
service_type: mon
service_name: mon
placement:
    hosts:
        - 'node1:[fde4:8dba:82e1:0:5054:ff:fecd:3d4e]'

# cephadm --verbose bootstrap --mon-ip [fde4:8dba:82e1:0:5054:ff:fecd:3d4e] --apply-spec /root/bootstrap-spec.yaml

Fails because `service_spec` does not suppor `[<IP>]` format:

DEBUG:cephadm:Running command: /usr/bin/podman run --rm --net=host --ipc=host -e CONTAINER_IMAGE=registry.suse.de/devel/storage/7.0/containers/ses/7/ceph/ceph -e NODE_NAME=node1 -v /var/log/ceph/3cebcb98-dd4f-11ea-9787-525400ca3d18:/var/log/ceph:z -v /tmp/ceph-tmp9bfj1zkg:/etc/ceph/ceph.client.admin.keyring:z -v /tmp/ceph-tmpg0xv6fke:/etc/ceph/ceph.conf:z -v /tmp/bootstrap-spec.yaml:/tmp/spec.yml:z --entrypoint /usr/bin/ceph registry.suse.de/devel/storage/7.0/containers/ses/7/ceph/ceph orch apply -i /tmp/spec.yml
DEBUG:cephadm:/usr/bin/ceph:stderr Error EINVAL: Traceback (most recent call last):
DEBUG:cephadm:/usr/bin/ceph:stderr   File "/usr/share/ceph/mgr/mgr_module.py", line 1167, in _handle_command
DEBUG:cephadm:/usr/bin/ceph:stderr     return self.handle_command(inbuf, cmd)
DEBUG:cephadm:/usr/bin/ceph:stderr   File "/usr/share/ceph/mgr/orchestrator/_interface.py", line 138, in handle_command
DEBUG:cephadm:/usr/bin/ceph:stderr     return dispatch[cmd['prefix']].call(self, cmd, inbuf)
DEBUG:cephadm:/usr/bin/ceph:stderr   File "/usr/share/ceph/mgr/mgr_module.py", line 311, in call
DEBUG:cephadm:/usr/bin/ceph:stderr     return self.func(mgr, **kwargs)
DEBUG:cephadm:/usr/bin/ceph:stderr   File "/usr/share/ceph/mgr/orchestrator/_interface.py", line 100, in <lambda>
DEBUG:cephadm:/usr/bin/ceph:stderr     wrapper_copy = lambda *l_args, **l_kwargs: wrapper(*l_args, **l_kwargs)
DEBUG:cephadm:/usr/bin/ceph:stderr   File "/usr/share/ceph/mgr/orchestrator/_interface.py", line 89, in wrapper
DEBUG:cephadm:/usr/bin/ceph:stderr     return func(*args, **kwargs)
DEBUG:cephadm:/usr/bin/ceph:stderr   File "/usr/share/ceph/mgr/orchestrator/module.py", line 1162, in _apply_misc
DEBUG:cephadm:/usr/bin/ceph:stderr     spec = json_to_generic_spec(s)
DEBUG:cephadm:/usr/bin/ceph:stderr   File "/usr/share/ceph/mgr/orchestrator/_interface.py", line 1217, in json_to_generic_spec
DEBUG:cephadm:/usr/bin/ceph:stderr     return ServiceSpec.from_json(spec)
DEBUG:cephadm:/usr/bin/ceph:stderr   File "/usr/lib/python3.6/site-packages/ceph/deployment/service_spec.py", line 42, in inner
DEBUG:cephadm:/usr/bin/ceph:profile rt=0.9018697738647461, stop=False, exit=None, reads=[12]
DEBUG:cephadm:/usr/bin/ceph:stderr     return method(cls, *args, **kwargs)
DEBUG:cephadm:/usr/bin/ceph:stderr   File "/usr/lib/python3.6/site-packages/ceph/deployment/service_spec.py", line 488, in from_json
DEBUG:cephadm:/usr/bin/ceph:stderr     return _cls._from_json_impl(c)  # type: ignore
DEBUG:cephadm:/usr/bin/ceph:stderr   File "/usr/lib/python3.6/site-packages/ceph/deployment/service_spec.py", line 495, in _from_json_impl
DEBUG:cephadm:/usr/bin/ceph:stderr     v = PlacementSpec.from_json(v)
DEBUG:cephadm:/usr/bin/ceph:stderr   File "/usr/lib/python3.6/site-packages/ceph/deployment/service_spec.py", line 42, in inner
DEBUG:cephadm:/usr/bin/ceph:stderr     return method(cls, *args, **kwargs)
DEBUG:cephadm:/usr/bin/ceph:stderr   File "/usr/lib/python3.6/site-packages/ceph/deployment/service_spec.py", line 245, in from_json
DEBUG:cephadm:/usr/bin/ceph:stderr     isinstance(host, str) else
DEBUG:cephadm:/usr/bin/ceph:stderr   File "/usr/lib/python3.6/site-packages/ceph/deployment/service_spec.py", line 134, in parse
DEBUG:cephadm:/usr/bin/ceph:stderr     raise e
DEBUG:cephadm:/usr/bin/ceph:stderr   File "/usr/lib/python3.6/site-packages/ceph/deployment/service_spec.py", line 131, in parse
DEBUG:cephadm:/usr/bin/ceph:stderr     ip_address(six.text_type(network))
DEBUG:cephadm:/usr/bin/ceph:stderr   File "/usr/lib64/python3.6/ipaddress.py", line 54, in ip_address
DEBUG:cephadm:/usr/bin/ceph:stderr     address)
DEBUG:cephadm:/usr/bin/ceph:stderr ValueError: '[fde4:8dba:82e1:0:5054:ff:fecd:3d4e]' does not appear to be an IPv4 or IPv6 address

3)
The combination that works is:

# cat /root/bootstrap-spec.yaml 
service_type: mgr
service_name: mgr
placement:
    hosts:
        - 'node1'
---
service_type: mon
service_name: mon
placement:
    hosts:
        - 'node1:fde4:8dba:82e1:0:5054:ff:fecd:3d4e'

# cephadm --verbose bootstrap --mon-ip [fde4:8dba:82e1:0:5054:ff:fecd:3d4e] --apply-spec /root/bootstrap-spec.yaml


Should we be consistent on the supported/required IPv6 syntax? If yes, which should be the correct one? Or should we support both?

History

#1 Updated by Matthew Oliver over 3 years ago

  • Assignee set to Matthew Oliver

I'll have a look into making sure IPv6 addresses can be given wrapped or unwrapped and we'd just detect and do accordingly rather then having to know which options require which version.

#2 Updated by Sebastian Wagner over 3 years ago

  • Status changed from New to Fix Under Review
  • Pull request ID set to 36676

#3 Updated by Ricardo Marques over 3 years ago

  • Status changed from Fix Under Review to Pending Backport

#4 Updated by Ricardo Marques over 3 years ago

  • Status changed from Pending Backport to Resolved

Also available in: Atom PDF