From 83a84182cd5dbd4571291f176f421d3fec572f5f Mon Sep 17 00:00:00 2001 From: Mark McClain Date: Mon, 22 Oct 2012 18:15:24 -0400 Subject: add port support when QuantumV2 subclass is used fixes bug 1070045 Fix the current implementation by checking if FLAGS.network_api_class is a subclass of nova.network.quantumv2.api.API. Previously, the API would not accept port references unless the network_api_class string was anything other than the QuantumV2 class. This limitation prevented subclassing. This changeset includes additional API unit tests focused on QuantumV2 and requested networks. Change-Id: I6b7b7389e127ff8b084ac379cb9aebccc102620c --- nova/api/openstack/compute/servers.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'nova/api') diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py index 89eac8bfd..c5e829d52 100644 --- a/nova/api/openstack/compute/servers.py +++ b/nova/api/openstack/compute/servers.py @@ -32,6 +32,8 @@ 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 from nova.openstack.common import timeutils @@ -597,8 +599,10 @@ class Controller(wsgi.Controller): return injected_files def _is_quantum_v2(self): - return FLAGS.network_api_class ==\ - "nova.network.quantumv2.api.API" + return issubclass( + importutils.import_class(FLAGS.network_api_class), + quantum_api.API + ) def _get_requested_networks(self, requested_networks): """Create a list of requested networks from the networks attribute.""" -- cgit