]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Use weak ref to avoid deleting fip namespace through agent
authorCarl Baldwin <carl.baldwin@hp.com>
Mon, 2 Feb 2015 23:34:24 +0000 (23:34 +0000)
committerCarl Baldwin <carl.baldwin@hp.com>
Thu, 5 Feb 2015 23:10:40 +0000 (23:10 +0000)
commit1584650a0db1620ebd3fe6fe7e45b9f0a045dc4b
tree879ce4464957bfdea29fb4010099b7968ac24a7a
parent9e645b145a667a376cb5d5731044321dc0d6122c
Use weak ref to avoid deleting fip namespace through agent

By using a weak ref in the agent to keep track of the fip namespaces,
we avoid having to call a method directly on the agent to delete a fip
namespace.  When the last router removes the last floating ip, the
fip_ns is marked destroyed and the router's strong reference is
removed.  This allows the garbage collector to reap it.  When the
agent goes looking for the fip namespace instance again, it will check
to see that it has not been garbage collected and that it has not been
destroyed before using it.

The goal here is to avoid having to ask the agent to delete a fip
namespace.  We know to delete a fip namespace when all of the floating
ips are gone.  We delete floating ips in the context of processing a
router.  So, having to call back out to the agent to destroy the fip
namespace is preventing some of this code from being moved in to the
router context.

Change-Id: I1b10f5d3233378ef9d8ef7b82659d3e775dac6b7
Partially-Implements: bp/restructure-l3-agent
neutron/agent/l3/agent.py
neutron/agent/l3/dvr.py
neutron/agent/l3/dvr_fip_ns.py
neutron/agent/l3/dvr_router.py
neutron/tests/unit/test_dvr_router.py
neutron/tests/unit/test_l3_agent.py