summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-10-25 12:05:31 +0000
committerGerrit Code Review <review@openstack.org>2012-10-25 12:05:31 +0000
commit0f31ed627f78cdb7cef86e1d1d837ffebd876f2c (patch)
treeb544fbfbe06613595cc8507e28c37bdd0ee87b16
parente6710a0193bf36812ec7bd65c757020a96bfe7f9 (diff)
parent8aea16c14dd4e9119bb75bc818772e19b934f8ab (diff)
downloadnova-0f31ed627f78cdb7cef86e1d1d837ffebd876f2c.tar.gz
nova-0f31ed627f78cdb7cef86e1d1d837ffebd876f2c.tar.xz
nova-0f31ed627f78cdb7cef86e1d1d837ffebd876f2c.zip
Merge "Improve the performance of quantum detection."
-rw-r--r--nova/api/openstack/compute/servers.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py
index b8f52dda4..9c182f3a5 100644
--- a/nova/api/openstack/compute/servers.py
+++ b/nova/api/openstack/compute/servers.py
@@ -436,6 +436,7 @@ class Controller(wsgi.Controller):
super(Controller, self).__init__(**kwargs)
self.compute_api = compute.API()
self.ext_mgr = ext_mgr
+ self.quantum_attempted = False
@wsgi.serializers(xml=MinimalServersTemplate)
def index(self, req):
@@ -598,14 +599,19 @@ class Controller(wsgi.Controller):
def _is_quantum_v2(self):
# NOTE(dprince): quantumclient is not a requirement
+ if self.quantum_attempted:
+ return self.have_quantum
+
try:
+ self.quantum_attempted = True
from nova.network.quantumv2 import api as quantum_api
- return issubclass(
+ self.have_quantum = issubclass(
importutils.import_class(FLAGS.network_api_class),
- quantum_api.API
- )
+ quantum_api.API)
except ImportError:
- return False
+ self.have_quantum = False
+
+ return self.have_quantum
def _get_requested_networks(self, requested_networks):
"""Create a list of requested networks from the networks attribute."""