Skip to content

Commit

Permalink
Improve the performance of quantum detection.
Browse files Browse the repository at this point in the history
Per https://review.openstack.org/#/c/14700 -- related to bug 1070509.

Change-Id: Ib9f829823136401a034b6bd3e1591508301132ba
  • Loading branch information
mikalstill authored and Gary Kotton committed Nov 22, 2012
1 parent 5e1b22c commit 1351c6b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions nova/api/openstack/compute/servers.py
Expand Up @@ -431,6 +431,7 @@ def __init__(self, ext_mgr=None, **kwargs):
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):
Expand Down Expand Up @@ -591,14 +592,19 @@ def _get_injected_files(self, personality):

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."""
Expand Down

0 comments on commit 1351c6b

Please sign in to comment.