From 31764456bd4536c920fb1d768fbdebf93e016a8a Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Mon, 1 Oct 2012 10:30:48 -0700 Subject: Stop network.api import on network import The nova.network.__init__.py was importing the network.api automatically at import time. This was leading to some silly workarounds (for example in nova/virt/firewall.py) involving late importing nova.network to stop circular imports. It is also causing issues with https://review.openstack.org/#/c/13007/ because quantum api needs to import a flag from network manager which is causing a circular import. This fixes the issue by moving to use the code from volume_api which only imports the api class when the method is called. It cleans up the tests that were stubbing out network.API and also removes the unneeded workarounds. Change-Id: I4c9b372d078ab4398e797335a8de5e9e1077e31f --- nova/api/openstack/compute/contrib/networks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'nova/api') diff --git a/nova/api/openstack/compute/contrib/networks.py b/nova/api/openstack/compute/contrib/networks.py index f673bf43a..62b4a6c80 100644 --- a/nova/api/openstack/compute/contrib/networks.py +++ b/nova/api/openstack/compute/contrib/networks.py @@ -23,7 +23,7 @@ from webob import exc from nova.api.openstack import extensions from nova import exception from nova import flags -import nova.network.api +from nova import network from nova.openstack.common import log as logging @@ -58,7 +58,7 @@ def network_dict(context, network): class NetworkController(object): def __init__(self, network_api=None): - self.network_api = network_api or nova.network.api.API() + self.network_api = network_api or network.API() def action(self, req, id, body): _actions = { -- cgit