metadata: Fix haproxy IPv6 bind address format

The haproxy ``bind`` directive for the metadata IPv6 link-local
address was generated without brackets:
``bind fe80::a9fe:a9fe:80 interface tapXXXX``. Without brackets,
haproxy interprets ``fe80::a9fe:a9fe:80`` as the full IPv6 address
``fe80:0:0:0:0:a9fe:a9fe:0080`` rather than address
``fe80::a9fe:a9fe`` with port ``80``, causing the metadata service
to never listen on the correct address.

Use the standard bracket notation ``bind [fe80::a9fe:a9fe]:80``
so haproxy unambiguously parses the address and port, making the
metadata service reachable over IPv6 from VMs.

Related-Bug: #2158258
Assisted-By: Claude Opus 4.6
Signed-off-by: Rodolfo Alonso Hernandez <ralonsoh@redhat.com>
Change-Id: Ia7c2f4e8d1b3a5f9e0c6d2b4a8f1c3e5d7b9a0f2
This commit is contained in:
Rodolfo Alonso Hernandez committed 2026-07-15 11:10:37 +02:00
1 parent 32f99902dd
commit afbe99a949
3 files changed
+3 -3

No files matched your search

+1 -1
View File
@@ -134,7 +134,7 @@ class HaproxyConfiguratorBase(metaclass=abc.ABCMeta):
cfg_info[key] = self.haproxy_config[key]
if self.host_v6 and self.bind_interface:
cfg_info['bind_v6_line'] = (
'bind {}:{} interface {}'.format(
'bind [{}]:{} interface {}'.format(
self.host_v6, self.port, self.bind_interface)
)
# If using the network ID, delete any spurious router ID that might
@@ -216,7 +216,7 @@ class TestMetadataDriverProcess(base.BaseTestCase):
"%s.conf" % router_id)
mock_open = self.useFixture(
lib_fixtures.OpenFixture(cfg_file)).mock_open
bind_v6_line = 'bind {}:{} interface {}'.format(
bind_v6_line = 'bind [{}]:{} interface {}'.format(
self.METADATA_DEFAULT_IPV6, self.METADATA_PORT, 'fake-if')
if dad_failed:
mock_wait.side_effect = ip_lib.DADFailed(
@@ -129,7 +129,7 @@ class TestMetadataDriverProcess(base.BaseTestCase):
"%s.conf" % datapath_id)
mock_open = self.useFixture(
lib_fixtures.OpenFixture(cfg_file)).mock_open
bind_v6_line = 'bind {}:{} interface {}'.format(
bind_v6_line = 'bind [{}]:{} interface {}'.format(
self.METADATA_DEFAULT_IPV6, self.METADATA_PORT, 'fake-if')
proxy = metadata_driver.MetadataDriver()
proxy.spawn_monitored_metadata_proxy(