diff --git a/neutron/agent/linux/dhcp.py b/neutron/agent/linux/dhcp.py index 3c05eb727d8..fb711b84d81 100644 --- a/neutron/agent/linux/dhcp.py +++ b/neutron/agent/linux/dhcp.py @@ -296,7 +296,7 @@ class DhcpLocalProcess(DhcpBase, metaclass=abc.ABCMeta): """Returns the file name for a given kind of config file.""" return os.path.join(self.network_conf_dir, kind) - def get_process_uuid(self): + def _get_process_uuid(self): if self.segment: # NOTE(sahid): Keep the order to match directory path. This is used # by external_process.ProcessManager to check whether the process @@ -349,7 +349,7 @@ class DhcpLocalProcess(DhcpBase, metaclass=abc.ABCMeta): def _get_process_manager(self, cmd_callback=None): return external_process.ProcessManager( conf=self.conf, - uuid=self.get_process_uuid(), + uuid=self._get_process_uuid(), namespace=self.network.namespace, service=DNSMASQ_SERVICE_NAME, default_cmd_callback=cmd_callback, diff --git a/neutron/tests/unit/agent/linux/test_dhcp.py b/neutron/tests/unit/agent/linux/test_dhcp.py index 8b72a385eac..9eeaa608147 100644 --- a/neutron/tests/unit/agent/linux/test_dhcp.py +++ b/neutron/tests/unit/agent/linux/test_dhcp.py @@ -1222,6 +1222,19 @@ class TestDhcpLocalProcess(TestBase): self.assertEqual(lp.called, ['spawn']) self.assertTrue(self.mock_mgr.return_value.setup.called) + def test_get_process_uuid(self): + net = FakeV4Network() + + lp = LocalChild(self.conf, net) + self.assertEqual( + "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa", + lp._get_process_uuid()) + + lp.segment = FakeSegment() + self.assertEqual( + "1212/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa", + lp._get_process_uuid()) + @mock.patch.object(fileutils, 'ensure_tree') def test_enable(self, ensure_dir): attrs_to_mock = dict(