Use Param DHCP_OPT_CLIENT_ID_NUM
Ironic is sending 'client-id' as a number (61) to meet rfc4776 [1], due to this change Neutron DHCP should support this option as well. [1]228a2a7885
Closes-Bug: #1770932 Change-Id: I9728354d5f9e08a0dc23900b2bc22b4a0aedb737 (cherry picked from commit59bc19c14a
)
This commit is contained in:
parent
88a500e2a3
commit
cf8478e340
|
@ -61,6 +61,9 @@ DNSMASQ_SERVICE_NAME = 'dnsmasq'
|
||||||
DHCP_RELEASE_TRIES = 3
|
DHCP_RELEASE_TRIES = 3
|
||||||
DHCP_RELEASE_TRIES_SLEEP = 0.3
|
DHCP_RELEASE_TRIES_SLEEP = 0.3
|
||||||
|
|
||||||
|
# this variable will be removed when neutron-lib is updated with this value
|
||||||
|
DHCP_OPT_CLIENT_ID_NUM = 61
|
||||||
|
|
||||||
|
|
||||||
class DictModel(dict):
|
class DictModel(dict):
|
||||||
"""Convert dict into an object that provides attribute access to values."""
|
"""Convert dict into an object that provides attribute access to values."""
|
||||||
|
@ -734,7 +737,8 @@ class Dnsmasq(DhcpLocalProcess):
|
||||||
def _get_client_id(self, port):
|
def _get_client_id(self, port):
|
||||||
if self._get_port_extra_dhcp_opts(port):
|
if self._get_port_extra_dhcp_opts(port):
|
||||||
for opt in port.extra_dhcp_opts:
|
for opt in port.extra_dhcp_opts:
|
||||||
if opt.opt_name == edo_ext.DHCP_OPT_CLIENT_ID:
|
if opt.opt_name in (edo_ext.DHCP_OPT_CLIENT_ID,
|
||||||
|
DHCP_OPT_CLIENT_ID_NUM):
|
||||||
return opt.opt_value
|
return opt.opt_value
|
||||||
|
|
||||||
def _read_hosts_file_leases(self, filename):
|
def _read_hosts_file_leases(self, filename):
|
||||||
|
@ -1021,7 +1025,8 @@ class Dnsmasq(DhcpLocalProcess):
|
||||||
[netaddr.IPAddress(ip.ip_address).version
|
[netaddr.IPAddress(ip.ip_address).version
|
||||||
for ip in port.fixed_ips])
|
for ip in port.fixed_ips])
|
||||||
for opt in port.extra_dhcp_opts:
|
for opt in port.extra_dhcp_opts:
|
||||||
if opt.opt_name == edo_ext.DHCP_OPT_CLIENT_ID:
|
if opt.opt_name in (edo_ext.DHCP_OPT_CLIENT_ID,
|
||||||
|
DHCP_OPT_CLIENT_ID_NUM):
|
||||||
continue
|
continue
|
||||||
opt_ip_version = opt.ip_version
|
opt_ip_version = opt.ip_version
|
||||||
if opt_ip_version in port_ip_versions:
|
if opt_ip_version in port_ip_versions:
|
||||||
|
|
|
@ -356,6 +356,13 @@ class FakePortMultipleAgents2(object):
|
||||||
self.extra_dhcp_opts = []
|
self.extra_dhcp_opts = []
|
||||||
|
|
||||||
|
|
||||||
|
class FakePortWithClientIdNum(object):
|
||||||
|
def __init__(self):
|
||||||
|
self.extra_dhcp_opts = [
|
||||||
|
DhcpOpt(opt_name=dhcp.DHCP_OPT_CLIENT_ID_NUM,
|
||||||
|
opt_value='test_client_id_num')]
|
||||||
|
|
||||||
|
|
||||||
class FakeV4HostRoute(object):
|
class FakeV4HostRoute(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.destination = '20.0.0.1/24'
|
self.destination = '20.0.0.1/24'
|
||||||
|
@ -623,6 +630,14 @@ class FakeV4NetworkClientId(object):
|
||||||
self.namespace = 'qdhcp-ns'
|
self.namespace = 'qdhcp-ns'
|
||||||
|
|
||||||
|
|
||||||
|
class FakeV4NetworkClientIdNum(object):
|
||||||
|
def __init__(self):
|
||||||
|
self.id = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'
|
||||||
|
self.subnets = [FakeV4Subnet()]
|
||||||
|
self.ports = [FakePortWithClientIdNum()]
|
||||||
|
self.namespace = 'qdhcp-ns'
|
||||||
|
|
||||||
|
|
||||||
class FakeV6Network(object):
|
class FakeV6Network(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.id = 'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb'
|
self.id = 'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb'
|
||||||
|
@ -2616,6 +2631,11 @@ class TestDnsmasq(TestBase):
|
||||||
'force_metadata': True}
|
'force_metadata': True}
|
||||||
self._test__generate_opts_per_subnet_helper(config, True)
|
self._test__generate_opts_per_subnet_helper(config, True)
|
||||||
|
|
||||||
|
def test_client_id_num(self):
|
||||||
|
dm = self._get_dnsmasq(FakeV4NetworkClientIdNum())
|
||||||
|
self.assertEqual('test_client_id_num',
|
||||||
|
dm._get_client_id(FakePortWithClientIdNum()))
|
||||||
|
|
||||||
|
|
||||||
class TestDeviceManager(TestConfBase):
|
class TestDeviceManager(TestConfBase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
For Infiniband support, Ironic needs to send the 'client-id' DHCP option
|
||||||
|
as a number in order for IP address assignment to work.
|
||||||
|
This is now supported in Neutron, and can be specified as option number
|
||||||
|
61 as defined in RFC 4776. For more information see bug
|
||||||
|
`1770932 <https://bugs.launchpad.net/neutron/+bug/1770932>`_
|
Loading…
Reference in New Issue