use flavors api def from neutron-lib
The flavors extension's API definition was rehomed into neutron-lib with commit I0229a80bb168bac8dc0fa17fb2b06f1b140d27b4 and will be consumed in neutron with I265ac1c0596d0fb0acaf99eeb7cfe9501732476f This patch follows suit, consuming the rehomed code from neutron-lib. Change-Id: I5d239cd3530f3139ab6ded646a499f1b8da90a37
This commit is contained in:
parent
d77a679bc3
commit
38cbb60d0f
@ -15,11 +15,12 @@
|
||||
# under the License.
|
||||
|
||||
from neutron.db import servicetype_db as st_db
|
||||
from neutron.extensions import flavors
|
||||
from neutron.services.flavors import flavors_plugin
|
||||
from neutron.services import provider_configuration as pconf
|
||||
from neutron.services import service_base
|
||||
from neutron_lib import context as ncontext
|
||||
from neutron_lib import exceptions as lib_exc
|
||||
from neutron_lib.exceptions import flavors as flav_exc
|
||||
from neutron_lib.plugins import constants
|
||||
from neutron_lib.plugins import directory
|
||||
from oslo_log import log as logging
|
||||
@ -124,10 +125,10 @@ class VPNDriverPlugin(VPNPlugin, vpn_db.VPNPluginRpcDbMixin):
|
||||
fl_db = flavors_plugin.FlavorsPlugin.get_flavor(
|
||||
self._flavors_plugin, context, flavor_id)
|
||||
if fl_db['service_type'] != constants.VPN:
|
||||
raise flavors.InvalidFlavorServiceType(
|
||||
raise lib_exc.InvalidServiceType(
|
||||
service_type=fl_db['service_type'])
|
||||
if not fl_db['enabled']:
|
||||
raise flavors.FlavorDisabled()
|
||||
raise flav_exc.FlavorDisabled()
|
||||
providers = flavors_plugin.FlavorsPlugin.get_flavor_next_provider(
|
||||
self._flavors_plugin, context, fl_db['id'])
|
||||
provider = providers[0].get('provider')
|
||||
|
@ -16,13 +16,14 @@ import contextlib
|
||||
|
||||
import mock
|
||||
from neutron.db import servicetype_db as st_db
|
||||
from neutron.extensions import flavors
|
||||
from neutron.services.flavors.flavors_plugin import FlavorsPlugin
|
||||
from neutron.tests.unit.db import test_agentschedulers_db
|
||||
from neutron.tests.unit.extensions import test_agent as test_agent_ext_plugin
|
||||
|
||||
from neutron_lib import constants as lib_constants
|
||||
from neutron_lib import context
|
||||
from neutron_lib import exceptions as lib_exc
|
||||
from neutron_lib.exceptions import flavors as flav_exc
|
||||
from neutron_lib.plugins import constants as p_constants
|
||||
from neutron_lib.plugins import directory
|
||||
from oslo_utils import uuidutils
|
||||
@ -288,7 +289,7 @@ class TestVPNDriverPluginMultipleDrivers(base.BaseTestCase):
|
||||
with self.vpnservices_providers_set():
|
||||
driver_plugin = vpn_plugin.VPNDriverPlugin()
|
||||
self.assertRaises(
|
||||
flavors.InvalidFlavorServiceType,
|
||||
lib_exc.InvalidServiceType,
|
||||
driver_plugin._get_provider_for_flavor,
|
||||
self.adminContext,
|
||||
_uuid())
|
||||
@ -303,7 +304,7 @@ class TestVPNDriverPluginMultipleDrivers(base.BaseTestCase):
|
||||
with self.vpnservices_providers_set():
|
||||
driver_plugin = vpn_plugin.VPNDriverPlugin()
|
||||
self.assertRaises(
|
||||
flavors.FlavorDisabled,
|
||||
flav_exc.FlavorDisabled,
|
||||
driver_plugin._get_provider_for_flavor,
|
||||
self.adminContext,
|
||||
_uuid())
|
||||
|
Loading…
Reference in New Issue
Block a user