]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Change L3 agent AdvancedService class to be non-singleton
authorAssaf Muller <amuller@redhat.com>
Mon, 23 Feb 2015 22:07:30 +0000 (17:07 -0500)
committerAssaf Muller <amuller@redhat.com>
Thu, 26 Feb 2015 00:09:27 +0000 (19:09 -0500)
commit911f8b57f80798ec8fe3c82282fb4c812cc9472c
tree0e446f1fcee5f9eb8e9ffc9321224d99412d918a
parent194afde3a64b70a934ec94f40550137ceacffbe2
Change L3 agent AdvancedService class to be non-singleton

The idea behind the AdvancedServices (Metadata, *aaS) services
to be singletons was to (1) offer a way to get an instance of such
a service in a convinient manner, and to (2) ensure that only one
service registered per service type.

(1) Since the AdvancedService.instance method required an instance
of a L3 agent, this point was kind of missed. If you have a L3 agent
instance in your hand, just use it to access the service you're looking
for.

(2) This is now fulfilled by asserting that only one driver is registered
(per type) in the .add method.

The motivation to make them non-singletons is that:
a) They don't need to be
b) The code is simplified this way
c) I've been facing crazy issues during functional testing where we're
   constantly instantiating L3 agents, and the (singleton) metadata
   service was referencing the wrong configuration object. The service
   was re-initialized during a test, screwing up the configuration of
   other mid-run tests.

Closes-Bug: #1425759
Depends-On: I155aece9b7028f1bdd3d9709facef392b38aec27
Depends-On: I199f6a967c64e921624b397fa5b7dfc56572d63a
Change-Id: I192e4d12380346c53c8ae0246371ccc41a836c4c
neutron/agent/l3/agent.py
neutron/agent/l3/event_observers.py
neutron/services/advanced_service.py
neutron/tests/common/agents/l3_agent.py
neutron/tests/unit/agent/test_l3_event_observers.py
neutron/tests/unit/services/test_advanced_service.py