Prevent stale DHCP directories for dhcp agent nodes
This change fixes an issue that is most acute in test/dev environments but that may affect production environments as well: the presence of DHCP directories that no longer represent networks that exist in the Neutron DB. This issue can manifest itself over time if you delete networks from the Server while the Agent node is down. Without this fix, at the agent start-up the method existing_dhcp_networks will return an empty list, and as a consequence the directories that belong to networks that have been removed from the server will stay because the sync logic will not process them as it only looks at the mismatch between active networks on the agent and active networks on the server. With the fix instead, we return *all* existing dhcp networks; if they are meant to be active, the agent will bring them up, if they no longer exist on the server, then the agent will dispose of the resources. The dnsmasq driver will do the right thing when enabling or disabling the process. Fixes bug #1195770 Change-Id: I194064a449801713051d01193adc706bcb687c82
This commit is contained in:
parent
3e564f8e03
commit
22c3ef8d65
@ -288,14 +288,9 @@ class Dnsmasq(DhcpLocalProcess):
|
||||
|
||||
confs_dir = os.path.abspath(os.path.normpath(conf.dhcp_confs))
|
||||
|
||||
class FakeNetwork:
|
||||
def __init__(self, net_id):
|
||||
self.id = net_id
|
||||
|
||||
return [
|
||||
c for c in os.listdir(confs_dir)
|
||||
if (uuidutils.is_uuid_like(c) and
|
||||
cls(conf, FakeNetwork(c), root_helper).active)
|
||||
if uuidutils.is_uuid_like(c)
|
||||
]
|
||||
|
||||
def spawn_process(self):
|
||||
|
@ -940,7 +940,8 @@ tag:tag1,249,%s,%s""".lstrip() % (fake_v6,
|
||||
result = dhcp.Dnsmasq.existing_dhcp_networks(self.conf, 'sudo')
|
||||
|
||||
mock_listdir.assert_called_once_with(path)
|
||||
self.assertEqual(['aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'],
|
||||
self.assertEqual(['aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa',
|
||||
'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb'],
|
||||
result)
|
||||
|
||||
def _check_version(self, cmd_out, expected_value):
|
||||
|
Loading…
Reference in New Issue
Block a user