Comment 3 for bug 1966135

Revision history for this message
Federico Bosi (rhxto) wrote :

I'm having the same issue in rev 165.
Moreover, when we call ovsdb-cluster/lib/ovsdb.py@_remote_addrs when joining the cluster,
We get the remote addresses via addr = self.format_addr(unit.received.get(key, '')) (key is 'bound-address') which has the square brackets.
This results in the _remote_addrs function returning an empty array for the remote connection string (format_address raises a ValueError because of the brackets, and we *ignore* value errors), and joining the cluster fails as we provide no remote addresses:
unit-ovn-central-0: 08:36:03 INFO unit.ovn-central/0.juju-log ovsdb-peer:17: ['ovsdb-tool', 'join-cluster', '/var/lib/ovn/ovnnb_db.db', 'OVN_Northbound', 'ssl:[my_local_ipv6_addr]:6643']
unit-ovn-central-0: 08:36:03 ERROR unit.ovn-central/0.juju-log ovsdb-peer:17: Hook error:
Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-ovn-central-0/.venv/lib/python3.10/site-packages/charms/reactive/__init__.py", line 74, in main
    bus.dispatch(restricted=restricted_mode)
  File "/var/lib/juju/agents/unit-ovn-central-0/.venv/lib/python3.10/site-packages/charms/reactive/bus.py", line 390, in dispatch
    _invoke(other_handlers)
  File "/var/lib/juju/agents/unit-ovn-central-0/.venv/lib/python3.10/site-packages/charms/reactive/bus.py", line 359, in _invoke
    handler.invoke()
  File "/var/lib/juju/agents/unit-ovn-central-0/.venv/lib/python3.10/site-packages/charms/reactive/bus.py", line 181, in invoke
    self._action(*args)
  File "/var/lib/juju/agents/unit-ovn-central-0/charm/reactive/ovn_central_handlers.py", line 245, in render
    ovn_charm.join_cluster('ovnnb_db.db', 'OVN_Northbound',
  File "/var/lib/juju/agents/unit-ovn-central-0/charm/lib/charm/openstack/ovn_central.py", line 500, in join_cluster
    self.run(*cmd)
  File "/var/lib/juju/agents/unit-ovn-central-0/charm/lib/charm/openstack/ovn_central.py", line 452, in run
    cp = subprocess.run(
  File "/usr/lib/python3.10/subprocess.py", line 526, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '('ovsdb-tool', 'join-cluster', '/var/lib/ovn/ovnnb_db.db', 'OVN_Northbound', 'ssl:[my_local_ipv6_addr]:6643')' returned non-zero exit status 1.

The exit status is because we need to pass at least 4 arguments.
I just added a .replace("[", "").replace("]", "") to the format_address function which resolved the first issue and I'm now facing this one.
Both these issues share the same cause and I'd agree with Frode, ipv6 addresses should be passed as pure addresses and formatted when necessary.