diff options
author | Zuul <zuul@review.opendev.org> | 2022-04-26 20:37:23 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2022-04-26 20:37:23 +0000 |
commit | 04e345f2d5788ccde1567084ca8d6a6e35e080fa (patch) | |
tree | 5be10a5ce15dad44f6b05371b20dc20ab63e6e87 | |
parent | 6c39d25ee0f3c9771ec0c0f63ee7d07faae68cdd (diff) | |
parent | a5e2c1540b407685f51c15b494002b0991775616 (diff) | |
download | neutron-04e345f2d5788ccde1567084ca8d6a6e35e080fa.tar.gz |
Merge "[DHCP] Break reference chain to any Exception object when resync" into stable/train
-rw-r--r-- | neutron/agent/dhcp/agent.py | 4 | ||||
-rw-r--r-- | neutron/tests/unit/agent/dhcp/test_agent.py | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/neutron/agent/dhcp/agent.py b/neutron/agent/dhcp/agent.py index e3becaa1ed..028845465a 100644 --- a/neutron/agent/dhcp/agent.py +++ b/neutron/agent/dhcp/agent.py @@ -208,7 +208,7 @@ class DhcpAgent(manager.Manager): # allocation failure. When the subnet is updated with a new # allocation pool or a port is deleted to free up an IP, this # will automatically be retried on the notification - self.schedule_resync(e, network.id) + self.schedule_resync(str(e), network.id) if (isinstance(e, oslo_messaging.RemoteError) and e.exc_type == 'NetworkNotFound' or isinstance(e, exceptions.NetworkNotFound)): @@ -333,7 +333,7 @@ class DhcpAgent(manager.Manager): net = "*" LOG.debug("resync (%(network)s): %(reason)s", {"reason": r, "network": net}) - self.sync_state(reasons.keys()) + self.sync_state(list(reasons.keys())) def periodic_resync(self): """Spawn a thread to periodically resync the dhcp state.""" diff --git a/neutron/tests/unit/agent/dhcp/test_agent.py b/neutron/tests/unit/agent/dhcp/test_agent.py index d109ba25ed..86e9a131d1 100644 --- a/neutron/tests/unit/agent/dhcp/test_agent.py +++ b/neutron/tests/unit/agent/dhcp/test_agent.py @@ -605,7 +605,7 @@ class TestDhcpAgent(base.BaseTestCase): sync_state.side_effect = RuntimeError with testtools.ExpectedException(RuntimeError): dhcp._periodic_resync_helper() - sync_state.assert_called_once_with(resync_reasons.keys()) + sync_state.assert_called_once_with(list(resync_reasons.keys())) self.assertEqual(0, len(dhcp.needs_resync_reasons)) def test_periodic_resync_helper_with_event(self): @@ -613,7 +613,7 @@ class TestDhcpAgent(base.BaseTestCase): dhcp = dhcp_agent.DhcpAgent(HOSTNAME) dhcp.schedule_resync('reason1', 'a') dhcp.schedule_resync('reason1', 'b') - reasons = dhcp.needs_resync_reasons.keys() + reasons = list(dhcp.needs_resync_reasons.keys()) with mock.patch.object(dhcp, 'sync_state') as sync_state: sync_state.side_effect = RuntimeError with testtools.ExpectedException(RuntimeError): |