Issue warning when running DHCP agent with dnsmasq < 2.67

dnsmasq < 2.67 does not support hwaddr matching for IPv6 clients, meaning IPv6
stateful subnets fail to provide IP addresses to instances.

Quoting dnsmasq CHANGELOG:

"
version 2.67
[...]
    Support identification of clients by MAC address in
    DHCPv6. When using a relay, the relay must support RFC
    6939 for this to work. It always works for directly
    connected clients. Thanks to Vladislav Grishenko
    for prompting this feature.
"

We cannot just exit as we do for dnsmasq < 2.63 since that would potentially
break DHCP agent startup for users that fetch the fix from git without bumping
dnsmasq version.

Appropriate release note will be added to notify operators about
incompatibility issue.

Change-Id: I9ef5c1a7cf564651b11b983185bd8d6b625a04dd
Closes-Bug: #1408297
This commit is contained in:
Ihar Hrachyshka 2015-01-08 14:54:35 +01:00
parent 74eff307b7
commit 097607aa8b
2 changed files with 20 additions and 0 deletions

View File

@ -313,6 +313,7 @@ class Dnsmasq(DhcpLocalProcess):
NEUTRON_NETWORK_ID_KEY = 'NEUTRON_NETWORK_ID'
NEUTRON_RELAY_SOCKET_PATH_KEY = 'NEUTRON_RELAY_SOCKET_PATH'
MINIMUM_VERSION = 2.63
MINIMUM_IPV6_VERSION = 2.67
@classmethod
def check_version(cls):
@ -328,6 +329,13 @@ class Dnsmasq(DhcpLocalProcess):
'Please ensure that its version is %s '
'or above!'), cls.MINIMUM_VERSION)
raise SystemExit(1)
is_valid_version = float(ver) >= cls.MINIMUM_IPV6_VERSION
if not is_valid_version:
LOG.warning(_('FAILED VERSION REQUIREMENT FOR DNSMASQ. '
'DHCP AGENT MAY NOT RUN CORRECTLY WHEN '
'SERVING IPV6 STATEFUL SUBNETS! '
'Please ensure that its version is %s '
'or above!'), cls.MINIMUM_IPV6_VERSION)
except (OSError, RuntimeError, IndexError, ValueError):
LOG.error(_('Unable to determine dnsmasq version. '
'Please ensure that its version is %s '

View File

@ -1372,6 +1372,18 @@ tag:tag0,option:router""".lstrip()
with testtools.ExpectedException(SystemExit):
self._check_version('Error while executing command', 0)
def test_check_version_ipv6_succeed(self):
with mock.patch('neutron.agent.linux.dhcp.LOG.warning') as warning:
self._check_version('Dnsmasq version 2.69 Copyright (c)...',
float(2.69))
self.assertFalse(warning.called)
def test_check_version_ipv6_fail(self):
with mock.patch('neutron.agent.linux.dhcp.LOG.warning') as warning:
self._check_version('Dnsmasq version 2.66 Copyright (c)...',
float(2.66))
self.assertTrue(warning.called)
def test_only_populates_dhcp_enabled_subnets(self):
exp_host_name = '/dhcp/eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee/host'
exp_host_data = ('00:00:80:aa:bb:cc,host-192-168-0-2.openstacklocal,'