Fix octavia to accept [ipv6]:port
A host identified by an Internet Protocol literal
address, version 6 [RFC3513] or later, is
distinguished by enclosing the IP literal
within square brackets ("[" and "]").
This patch fixes octavia to be able parse and
use this format.
Story 2010655
Task 47687
Change-Id: Ib1e00a0b45776cfab80b9effb2690e12fea63e78
This commit is contained in:
@@ -70,6 +70,8 @@ class UDPStatusSender(object):
|
|||||||
for ipport in CONF.health_manager.controller_ip_port_list:
|
for ipport in CONF.health_manager.controller_ip_port_list:
|
||||||
try:
|
try:
|
||||||
ip, port = ipport.rsplit(':', 1)
|
ip, port = ipport.rsplit(':', 1)
|
||||||
|
if ip and ip[0] == '[' and ip[-1] == ']':
|
||||||
|
ip = ip[1:-1]
|
||||||
except ValueError:
|
except ValueError:
|
||||||
LOG.error("Invalid ip and port '%s' in health_manager "
|
LOG.error("Invalid ip and port '%s' in health_manager "
|
||||||
"controller_ip_port_list", ipport)
|
"controller_ip_port_list", ipport)
|
||||||
|
|||||||
@@ -93,6 +93,24 @@ class TestHealthSender(base.TestCase):
|
|||||||
|
|
||||||
sendto_mock.reset_mock()
|
sendto_mock.reset_mock()
|
||||||
|
|
||||||
|
# Test IPv6 path enclosed within square brackets ("[" and "]").
|
||||||
|
self.conf.config(group="health_manager",
|
||||||
|
controller_ip_port_list=['[2001:0db8::f00d]:80'])
|
||||||
|
mock_getaddrinfo.return_value = [(socket.AF_INET6,
|
||||||
|
socket.SOCK_DGRAM,
|
||||||
|
socket.IPPROTO_UDP,
|
||||||
|
'',
|
||||||
|
('2001:db8::f00d', 80, 0, 0))]
|
||||||
|
|
||||||
|
sender = health_sender.UDPStatusSender()
|
||||||
|
|
||||||
|
sender.dosend(SAMPLE_MSG)
|
||||||
|
|
||||||
|
sendto_mock.assert_called_once_with(SAMPLE_MSG_BIN,
|
||||||
|
('2001:db8::f00d', 80, 0, 0))
|
||||||
|
|
||||||
|
sendto_mock.reset_mock()
|
||||||
|
|
||||||
# Test IPv6 link-local address path
|
# Test IPv6 link-local address path
|
||||||
self.conf.config(
|
self.conf.config(
|
||||||
group="health_manager",
|
group="health_manager",
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Fix a bug that prevented the operating_status of a health-monitor to be
|
||||||
|
set to ONLINE when ipv6 addresses were enclosed within square brackets
|
||||||
|
in ``controller_ip_port_list``.
|
||||||
Reference in New Issue
Block a user