Move existing V2 to legacy_v2 - step 2
The second step in the code cleanup for removing the API V3 references is to move the existing 'contrib' directory under 'legacy_v2'. All references to the 'contrib' directory have been updated to reflect the new path. Also ensure the old path works for option 'osapi_compute_ext_list'. When 'nova.api.openstack.extensions.ExtensionManager' load old path, it will use new path instead of it. Partial-Bug: #1462901 Co-Authored-By: Alex Xu <hejie.xu@intel.com> Change-Id: I9cf405ec8230094f0f921010d4e18c710d9cbdbb
This commit is contained in:
parent
a7ca5069fc
commit
81dd5b78c8
|
@ -29,7 +29,7 @@ ext_opts = [
|
|||
default=[],
|
||||
help='Specify list of extensions to load when using osapi_'
|
||||
'compute_extension option with nova.api.openstack.'
|
||||
'compute.contrib.select_extensions'),
|
||||
'compute.legacy_v2.contrib.select_extensions'),
|
||||
]
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opts(ext_opts)
|
|
@ -16,7 +16,7 @@ import six
|
|||
import webob
|
||||
from webob import exc
|
||||
|
||||
from nova.api.openstack.compute.contrib import security_groups as sg
|
||||
from nova.api.openstack.compute.legacy_v2.contrib import security_groups as sg
|
||||
from nova.api.openstack import extensions
|
||||
from nova import context as nova_context
|
||||
from nova import exception
|
|
@ -19,11 +19,11 @@ from oslo_log import log as logging
|
|||
from nova.api.openstack import extensions as base_extensions
|
||||
|
||||
ext_opts = [
|
||||
cfg.MultiStrOpt('osapi_compute_extension',
|
||||
default=[
|
||||
'nova.api.openstack.compute.contrib.standard_extensions'
|
||||
],
|
||||
help='osapi compute extension to load'),
|
||||
cfg.MultiStrOpt(
|
||||
'osapi_compute_extension',
|
||||
default=['nova.api.openstack.compute.legacy_v2.contrib.'
|
||||
'standard_extensions'],
|
||||
help='osapi compute extension to load'),
|
||||
]
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opts(ext_opts)
|
||||
|
|
|
@ -33,7 +33,8 @@ ALIAS = "os-fping"
|
|||
authorize = extensions.os_compute_authorizer(ALIAS)
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.import_opt('fping_path', 'nova.api.openstack.compute.contrib.fping')
|
||||
CONF.import_opt('fping_path', 'nova.api.openstack.compute.legacy_v2.contrib.'
|
||||
'fping')
|
||||
|
||||
|
||||
class FpingController(wsgi.Controller):
|
||||
|
|
|
@ -34,14 +34,14 @@ from nova import quota
|
|||
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.import_opt('enable_network_quota',
|
||||
'nova.api.openstack.compute.contrib.os_tenant_networks')
|
||||
CONF.import_opt('use_neutron_default_nets',
|
||||
'nova.api.openstack.compute.contrib.os_tenant_networks')
|
||||
CONF.import_opt('neutron_default_tenant_id',
|
||||
'nova.api.openstack.compute.contrib.os_tenant_networks')
|
||||
CONF.import_opt('quota_networks',
|
||||
'nova.api.openstack.compute.contrib.os_tenant_networks')
|
||||
CONF.import_opt('enable_network_quota', 'nova.api.openstack.compute.'
|
||||
'legacy_v2.contrib.os_tenant_networks')
|
||||
CONF.import_opt('use_neutron_default_nets', 'nova.api.openstack.compute.'
|
||||
'legacy_v2.contrib.os_tenant_networks')
|
||||
CONF.import_opt('neutron_default_tenant_id', 'nova.api.openstack.compute.'
|
||||
'legacy_v2.contrib.os_tenant_networks')
|
||||
CONF.import_opt('quota_networks', 'nova.api.openstack.compute.'
|
||||
'legacy_v2.contrib.os_tenant_networks')
|
||||
|
||||
|
||||
ALIAS = 'os-tenant-networks'
|
||||
|
|
|
@ -210,6 +210,13 @@ class ExtensionManager(object):
|
|||
LOG.debug("Loading extension %s", ext_factory)
|
||||
|
||||
if isinstance(ext_factory, six.string_types):
|
||||
if ext_factory.startswith('nova.api.openstack.compute.contrib'):
|
||||
LOG.warn(_LW("The legacy v2 API module already moved into"
|
||||
"'nova.api.openstack.compute.legacy_v2.contrib'. "
|
||||
"Use new path instead of old path %s"),
|
||||
ext_factory)
|
||||
ext_factory = ext_factory.replace('contrib',
|
||||
'legacy_v2.contrib')
|
||||
# Load the factory
|
||||
factory = importutils.import_class(ext_factory)
|
||||
else:
|
||||
|
|
|
@ -21,9 +21,9 @@ import nova.api.metadata.vendordata_json
|
|||
import nova.api.openstack
|
||||
import nova.api.openstack.common
|
||||
import nova.api.openstack.compute
|
||||
import nova.api.openstack.compute.contrib
|
||||
import nova.api.openstack.compute.contrib.fping
|
||||
import nova.api.openstack.compute.contrib.os_tenant_networks
|
||||
import nova.api.openstack.compute.legacy_v2.contrib
|
||||
import nova.api.openstack.compute.legacy_v2.contrib.fping
|
||||
import nova.api.openstack.compute.legacy_v2.contrib.os_tenant_networks
|
||||
import nova.api.openstack.compute.legacy_v2.extensions
|
||||
import nova.api.openstack.compute.legacy_v2.servers
|
||||
import nova.api.openstack.compute.plugins.v3.hide_server_addresses
|
||||
|
@ -134,9 +134,9 @@ def list_opts():
|
|||
nova.api.metadata.base.metadata_opts,
|
||||
nova.api.metadata.handler.metadata_opts,
|
||||
nova.api.openstack.common.osapi_opts,
|
||||
nova.api.openstack.compute.contrib.ext_opts,
|
||||
nova.api.openstack.compute.contrib.fping.fping_opts,
|
||||
nova.api.openstack.compute.contrib.os_tenant_networks.
|
||||
nova.api.openstack.compute.legacy_v2.contrib.ext_opts,
|
||||
nova.api.openstack.compute.legacy_v2.contrib.fping.fping_opts,
|
||||
nova.api.openstack.compute.legacy_v2.contrib.os_tenant_networks.
|
||||
os_network_opts,
|
||||
nova.api.openstack.compute.legacy_v2.extensions.ext_opts,
|
||||
nova.api.openstack.compute.plugins.v3.hide_server_addresses.opts,
|
||||
|
|
|
@ -39,7 +39,8 @@ CONF = cfg.CONF
|
|||
CONF.import_opt('allow_resize_to_same_host', 'nova.compute.api')
|
||||
CONF.import_opt('shelved_offload_time', 'nova.compute.manager')
|
||||
CONF.import_opt('enable_network_quota',
|
||||
'nova.api.openstack.compute.contrib.os_tenant_networks')
|
||||
'nova.api.openstack.compute.legacy_v2.contrib.'
|
||||
'os_tenant_networks')
|
||||
CONF.import_opt('osapi_compute_extension',
|
||||
'nova.api.openstack.compute.legacy_v2.extensions')
|
||||
CONF.import_opt('osapi_compute_link_prefix', 'nova.api.openstack.common')
|
||||
|
@ -166,7 +167,7 @@ class ServersSampleBase(ApiSampleTestBaseV2):
|
|||
|
||||
|
||||
class ServersSampleMultiStatusJsonTest(ServersSampleBase):
|
||||
extension_name = '.'.join(('nova.api.openstack.compute.contrib',
|
||||
extension_name = '.'.join(('nova.api.openstack.compute.legacy_v2.contrib',
|
||||
'server_list_multi_status',
|
||||
'Server_list_multi_status'))
|
||||
|
||||
|
@ -206,7 +207,7 @@ class LimitsSampleJsonTest(ApiSampleTestBaseV2):
|
|||
|
||||
|
||||
class VirtualInterfacesJsonTest(ServersSampleBase):
|
||||
extension_name = ("nova.api.openstack.compute.contrib"
|
||||
extension_name = ("nova.api.openstack.compute.legacy_v2.contrib"
|
||||
".virtual_interfaces.Virtual_interfaces")
|
||||
|
||||
def test_vifs_list(self):
|
||||
|
@ -221,8 +222,8 @@ class VirtualInterfacesJsonTest(ServersSampleBase):
|
|||
|
||||
|
||||
class UsedLimitsSamplesJsonTest(ApiSampleTestBaseV2):
|
||||
extension_name = ("nova.api.openstack.compute.contrib.used_limits."
|
||||
"Used_limits")
|
||||
extension_name = ("nova.api.openstack.compute.legacy_v2.contrib."
|
||||
"used_limits.Used_limits")
|
||||
|
||||
def test_get_used_limits(self):
|
||||
# Get api sample to used limits.
|
||||
|
@ -233,10 +234,10 @@ class UsedLimitsSamplesJsonTest(ApiSampleTestBaseV2):
|
|||
|
||||
class UsedLimitsForAdminSamplesJsonTest(ApiSampleTestBaseV2):
|
||||
ADMIN_API = True
|
||||
extends_name = ("nova.api.openstack.compute.contrib.used_limits."
|
||||
extends_name = ("nova.api.openstack.compute.legacy_v2.contrib.used_limits."
|
||||
"Used_limits")
|
||||
extension_name = (
|
||||
"nova.api.openstack.compute.contrib.used_limits_for_admin."
|
||||
"nova.api.openstack.compute.legacy_v2.contrib.used_limits_for_admin."
|
||||
"Used_limits_for_admin")
|
||||
|
||||
def test_get_used_limits_for_admin(self):
|
||||
|
@ -248,7 +249,7 @@ class UsedLimitsForAdminSamplesJsonTest(ApiSampleTestBaseV2):
|
|||
|
||||
|
||||
class ExtendedIpsSampleJsonTests(ServersSampleBase):
|
||||
extension_name = ("nova.api.openstack.compute.contrib"
|
||||
extension_name = ("nova.api.openstack.compute.legacy_v2.contrib"
|
||||
".extended_ips.Extended_ips")
|
||||
|
||||
def test_show(self):
|
||||
|
@ -270,7 +271,7 @@ class ExtendedIpsSampleJsonTests(ServersSampleBase):
|
|||
|
||||
|
||||
class ExtendedIpsMacSampleJsonTests(ServersSampleBase):
|
||||
extension_name = ("nova.api.openstack.compute.contrib"
|
||||
extension_name = ("nova.api.openstack.compute.legacy_v2.contrib"
|
||||
".extended_ips_mac.Extended_ips_mac")
|
||||
|
||||
def test_show(self):
|
||||
|
@ -296,7 +297,7 @@ class ExtendedIpsMacSampleJsonTests(ServersSampleBase):
|
|||
|
||||
|
||||
class ExtendedVIFNetSampleJsonTests(ServersSampleBase):
|
||||
extension_name = ("nova.api.openstack.compute.contrib"
|
||||
extension_name = ("nova.api.openstack.compute.legacy_v2.contrib"
|
||||
".extended_virtual_interfaces_net.Extended_virtual_interfaces_net")
|
||||
|
||||
def _get_flags(self):
|
||||
|
@ -305,7 +306,7 @@ class ExtendedVIFNetSampleJsonTests(ServersSampleBase):
|
|||
# extended_virtual_interfaces_net_update also
|
||||
# needs virtual_interfaces to be loaded
|
||||
f['osapi_compute_extension'].append(
|
||||
('nova.api.openstack.compute.contrib'
|
||||
('nova.api.openstack.compute.legacy_v2.contrib'
|
||||
'.virtual_interfaces.Virtual_interfaces'))
|
||||
return f
|
||||
|
||||
|
@ -322,7 +323,7 @@ class ExtendedVIFNetSampleJsonTests(ServersSampleBase):
|
|||
|
||||
|
||||
class BlockDeviceMappingV2BootJsonTest(ServersSampleBase):
|
||||
extension_name = ('nova.api.openstack.compute.contrib.'
|
||||
extension_name = ('nova.api.openstack.compute.legacy_v2.contrib.'
|
||||
'block_device_mapping_v2_boot.'
|
||||
'Block_device_mapping_v2_boot')
|
||||
|
||||
|
@ -331,7 +332,7 @@ class BlockDeviceMappingV2BootJsonTest(ServersSampleBase):
|
|||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
# We need the volumes extension as well
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.volumes.Volumes')
|
||||
'nova.api.openstack.compute.legacy_v2.contrib.volumes.Volumes')
|
||||
return f
|
||||
|
||||
def test_servers_post_with_bdm_v2(self):
|
||||
|
@ -343,12 +344,12 @@ class BlockDeviceMappingV2BootJsonTest(ServersSampleBase):
|
|||
|
||||
class ServerGroupQuotas_LimitsSampleJsonTest(LimitsSampleJsonTest):
|
||||
sample_dir = None
|
||||
extension_name = ("nova.api.openstack.compute.contrib."
|
||||
extension_name = ("nova.api.openstack.compute.legacy_v2.contrib."
|
||||
"server_group_quotas.Server_group_quotas")
|
||||
|
||||
|
||||
class ServerGroupQuotas_UsedLimitsSamplesJsonTest(UsedLimitsSamplesJsonTest):
|
||||
extension_name = ("nova.api.openstack.compute.contrib."
|
||||
extension_name = ("nova.api.openstack.compute.legacy_v2.contrib."
|
||||
"server_group_quotas.Server_group_quotas")
|
||||
extends_name = ("nova.api.openstack.compute.contrib.used_limits."
|
||||
extends_name = ("nova.api.openstack.compute.legacy_v2.contrib.used_limits."
|
||||
"Used_limits")
|
||||
|
|
|
@ -65,7 +65,7 @@ class BareMetalNodesSampleJsonTest(api_sample_base.ApiSampleTestBaseV3):
|
|||
|
||||
@mock.patch("nova.api.openstack.compute.plugins.v3.baremetal_nodes"
|
||||
"._get_ironic_client")
|
||||
@mock.patch("nova.api.openstack.compute.contrib.baremetal_nodes"
|
||||
@mock.patch("nova.api.openstack.compute.legacy_v2.contrib.baremetal_nodes"
|
||||
"._get_ironic_client")
|
||||
def test_baremetal_nodes_list(self, mock_get_irc, v2_1_mock_get_irc):
|
||||
mock_get_irc.return_value = fake_client()
|
||||
|
@ -77,7 +77,7 @@ class BareMetalNodesSampleJsonTest(api_sample_base.ApiSampleTestBaseV3):
|
|||
|
||||
@mock.patch("nova.api.openstack.compute.plugins.v3.baremetal_nodes"
|
||||
"._get_ironic_client")
|
||||
@mock.patch("nova.api.openstack.compute.contrib.baremetal_nodes"
|
||||
@mock.patch("nova.api.openstack.compute.legacy_v2.contrib.baremetal_nodes"
|
||||
"._get_ironic_client")
|
||||
def test_baremetal_nodes_get(self, mock_get_irc, v2_1_mock_get_irc):
|
||||
mock_get_irc.return_value = fake_client()
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
from oslo_config import cfg
|
||||
|
||||
from nova.api.openstack.compute.contrib import fping as fping_v2
|
||||
from nova.api.openstack.compute.legacy_v2.contrib import fping as fping_v2
|
||||
from nova.api.openstack.compute.plugins.v3 import fping
|
||||
from nova.tests.functional.v3 import test_servers
|
||||
from nova.tests.unit.api.openstack.compute.contrib import test_fping
|
||||
|
|
|
@ -22,7 +22,8 @@ from nova.tests.functional.v3 import api_sample_base
|
|||
|
||||
CONF = cfg.CONF
|
||||
CONF.import_opt('enable_network_quota',
|
||||
'nova.api.openstack.compute.contrib.os_tenant_networks')
|
||||
'nova.api.openstack.compute.legacy_v2.contrib.'
|
||||
'os_tenant_networks')
|
||||
CONF.import_opt('osapi_compute_extension',
|
||||
'nova.api.openstack.compute.legacy_v2.extensions')
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue