]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Refactor _process_routers to handle a single router
authorCarl Baldwin <carl.baldwin@hp.com>
Thu, 2 Oct 2014 20:35:21 +0000 (20:35 +0000)
committerCarl Baldwin <carl.baldwin@hp.com>
Thu, 9 Oct 2014 18:51:13 +0000 (18:51 +0000)
commit5e9305a6f934549408a9c18480fc1c000126621e
tree8ce29447dd7e12be950f6612f4bb325eb822c031
parent97374243752605cff1ae1a2a52a99b6c2d670c4f
Refactor _process_routers to handle a single router

The method _process_routers no longer handles multiple routers.  The
only caller of this method would construct a list of exactly one
router in order to make the call.  This made the for loop unnecessary.
The method's logic is too heavy for its current purpose.  This commit
removes much of the weight.

The use of the sets in this method is also no longer necessary.  It
became clear that all of it boiled down to "if the router is not
compatible with with this agent but it is known in router_info from
before then we need to remove it."  This is an exceptional condition
that shouldn't be handled in this method so I raise an exception and
handle it in process_router_update where other router removal is
handled.  Logging was added for this exceptional condition.

The eventlet pool was also obsolete.  It was used to spawn two methods
and there was a waitall at the end.  The other refactoring made it
clear that the two spawns were mutually exclusive.  There was only one
thread spawned for any given invocation of the method and the eventlet
pool is overkill.

Change-Id: Ibeac591b08565d10b2a9730e25a54f2cd11fc2bc
Closes-Bug: #1378398
neutron/agent/l3_agent.py
neutron/common/exceptions.py
neutron/services/vpn/agent.py
neutron/tests/unit/services/vpn/test_vpn_agent.py
neutron/tests/unit/test_l3_agent.py