Merge "Don't require quantumclient when running nova-api." into stable/folsom

This commit is contained in:
Jenkins 2012-11-22 18:12:01 +00:00 committed by Gerrit Code Review
commit 5e1b22ca69
2 changed files with 11 additions and 7 deletions

View File

@ -32,7 +32,6 @@ from nova import compute
from nova.compute import instance_types
from nova import exception
from nova import flags
from nova.network.quantumv2 import api as quantum_api
from nova.openstack.common import importutils
from nova.openstack.common import log as logging
from nova.openstack.common.rpc import common as rpc_common
@ -591,10 +590,15 @@ class Controller(wsgi.Controller):
return injected_files
def _is_quantum_v2(self):
return issubclass(
importutils.import_class(FLAGS.network_api_class),
quantum_api.API
)
# NOTE(dprince): quantumclient is not a requirement
try:
from nova.network.quantumv2 import api as quantum_api
return issubclass(
importutils.import_class(FLAGS.network_api_class),
quantum_api.API
)
except ImportError:
return False
def _get_requested_networks(self, requested_networks):
"""Create a list of requested networks from the networks attribute."""

View File

@ -38,7 +38,7 @@ import nova.db
from nova.db.sqlalchemy import models
from nova import flags
from nova.network import manager
from nova.network import quantumv2
from nova.network.quantumv2 import api as quantum_api
from nova.openstack.common import jsonutils
import nova.openstack.common.rpc
from nova import test
@ -134,7 +134,7 @@ class Base64ValidationTest(test.TestCase):
self.assertEqual(result, None)
class QuantumV2Subclass(quantumv2.api.API):
class QuantumV2Subclass(quantum_api.API):
"""Used to ensure that API handles subclasses properly."""
pass