Don't initialize neutronv2 state at module import

Currently, neutronv2.API defines conductor_api when the module is
imported. This could easily happen before any configuration files are
parsed so e.g. use_local may not be applied.

In the case of oslo.messaging, I was seeing this cause problems bcause
it was happening before oslo.messaging transport was initialized.

blueprint: oslo-messaging
Change-Id: Ia193442d9c9156b1afdbb24be3c83f4be3c8f35f
This commit is contained in:
Mark McLoughlin 2013-08-19 22:30:08 +01:00
parent 856db7efad
commit 4a661dd961
1 changed files with 3 additions and 3 deletions

View File

@ -103,13 +103,13 @@ update_instance_info_cache = network_api.update_instance_cache_with_nw_info
class API(base.Base):
"""API for interacting with the neutron 2.x API."""
conductor_api = conductor.API()
security_group_api = openstack_driver.get_openstack_security_group_driver()
def __init__(self):
super(API, self).__init__()
self.last_neutron_extension_sync = None
self.extensions = {}
self.conductor_api = conductor.API()
self.security_group_api = (
openstack_driver.get_openstack_security_group_driver())
def setup_networks_on_host(self, context, instance, host=None,
teardown=False):