[DHCP] Break reference chain to any Exception object when resync
In the DHCP agent, if an exception is raised during the driver call,
"DhcpAgent.schedule_resync" is called. Before this patch, the
exception instance was passed instead of a string. This instance
reference was stored in the dictionary "needs_resync_reasons" and
used in "_periodic_resync_helper" to resync the DHCP agent
information.
The call to "sync_state" passed the dictionary ".keys()" method. In
python2.7 when that was implemented, this method was creating a list
with the dictionary keys. In python3, this method is a generator
that holds the dictionary content.
This patch breaks this reference chain in two points (actually only
one is needed):
- "sync_state" now passes a list created from the mentioned generator.
- The dictionary "needs_resync_reasons" now stores the exception
strings only, instead of the exception instance.
Closes-Bug: #1969270
Change-Id: I07e9818021283d321fc32066be7e0f8e2b81e639
(cherry picked from commit e3b3ec930967305e5fce314c0a4cf74151ad711c)
Reviewed: https:/ /review. opendev. org/c/openstack /neutron/ +/838897 /opendev. org/openstack/ neutron/ commit/ 85055d8c65f70e3 90af54227ace60a 788121683b
Committed: https:/
Submitter: "Zuul (22348)"
Branch: stable/xena
commit 85055d8c65f70e3 90af54227ace60a 788121683b
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Wed Apr 13 23:38:04 2022 +0000
[DHCP] Break reference chain to any Exception object when resync
In the DHCP agent, if an exception is raised during the driver call, schedule_ resync" is called. Before this patch, the resync_ reasons" and resync_ helper" to resync the DHCP agent
"DhcpAgent.
exception instance was passed instead of a string. This instance
reference was stored in the dictionary "needs_
used in "_periodic_
information.
The call to "sync_state" passed the dictionary ".keys()" method. In
python2.7 when that was implemented, this method was creating a list
with the dictionary keys. In python3, this method is a generator
that holds the dictionary content.
This patch breaks this reference chain in two points (actually only resync_ reasons" now stores the exception
one is needed):
- "sync_state" now passes a list created from the mentioned generator.
- The dictionary "needs_
strings only, instead of the exception instance.
Closes-Bug: #1969270 321fc32066be7e0 f8e2b81e639 e5fce314c0a4cf7 4151ad711c)
Change-Id: I07e9818021283d
(cherry picked from commit e3b3ec930967305