From 2581554921281dc6c8271d8eb1f357f208811512 Mon Sep 17 00:00:00 2001 From: Mike Perez Date: Mon, 12 Nov 2012 21:13:55 -0800 Subject: [PATCH] Moving contrib to cinder.api This moves over all contrib to a common place for all api versions to use. Test directory structure has been adjusted to match. For compatibility with old cinder config settings, we ignore the old contrib path and use the new location. progress on blueprint apiv2 Change-Id: If1a24fd3c4d15db559674a021f6928613966e3a1 --- .../volume => }/contrib/__init__.py | 0 .../volume => }/contrib/admin_actions.py | 0 .../contrib/extended_snapshot_attributes.py | 0 .../volume => }/contrib/image_create.py | 0 .../volume => }/contrib/quota_classes.py | 0 .../{openstack/volume => }/contrib/quotas.py | 0 .../volume => }/contrib/types_extra_specs.py | 0 .../volume => }/contrib/types_manage.py | 0 .../volume => }/contrib/volume_actions.py | 0 .../contrib/volume_host_attribute.py | 0 .../contrib/volume_tenant_attribute.py | 0 cinder/api/extensions.py | 14 ++++++++++++++ cinder/api/openstack/volume/__init__.py | 17 ----------------- cinder/flags.py | 11 +++++++---- .../{openstack/volume => contrib}/__init__.py | 0 .../volume => }/contrib/test_admin_actions.py | 0 .../test_extended_snapshot_attributes.py | 2 +- .../contrib/test_types_extra_specs.py | 2 +- .../volume => }/contrib/test_types_manage.py | 2 +- .../contrib/test_volume_actions.py | 2 +- .../contrib/test_volume_host_attribute.py | 0 .../contrib/test_volume_tenant_attribute.py | 0 .../api/openstack/volume/contrib/__init__.py | 19 ------------------- 23 files changed, 25 insertions(+), 44 deletions(-) rename cinder/api/{openstack/volume => }/contrib/__init__.py (100%) rename cinder/api/{openstack/volume => }/contrib/admin_actions.py (100%) rename cinder/api/{openstack/volume => }/contrib/extended_snapshot_attributes.py (100%) rename cinder/api/{openstack/volume => }/contrib/image_create.py (100%) rename cinder/api/{openstack/volume => }/contrib/quota_classes.py (100%) rename cinder/api/{openstack/volume => }/contrib/quotas.py (100%) rename cinder/api/{openstack/volume => }/contrib/types_extra_specs.py (100%) rename cinder/api/{openstack/volume => }/contrib/types_manage.py (100%) rename cinder/api/{openstack/volume => }/contrib/volume_actions.py (100%) rename cinder/api/{openstack/volume => }/contrib/volume_host_attribute.py (100%) rename cinder/api/{openstack/volume => }/contrib/volume_tenant_attribute.py (100%) delete mode 100644 cinder/api/openstack/volume/__init__.py rename cinder/tests/api/{openstack/volume => contrib}/__init__.py (100%) rename cinder/tests/api/{openstack/volume => }/contrib/test_admin_actions.py (100%) rename cinder/tests/api/{openstack/volume => }/contrib/test_extended_snapshot_attributes.py (98%) rename cinder/tests/api/{openstack/volume => }/contrib/test_types_extra_specs.py (99%) rename cinder/tests/api/{openstack/volume => }/contrib/test_types_manage.py (98%) rename cinder/tests/api/{openstack/volume => }/contrib/test_volume_actions.py (99%) rename cinder/tests/api/{openstack/volume => }/contrib/test_volume_host_attribute.py (100%) rename cinder/tests/api/{openstack/volume => }/contrib/test_volume_tenant_attribute.py (100%) delete mode 100644 cinder/tests/api/openstack/volume/contrib/__init__.py diff --git a/cinder/api/openstack/volume/contrib/__init__.py b/cinder/api/contrib/__init__.py similarity index 100% rename from cinder/api/openstack/volume/contrib/__init__.py rename to cinder/api/contrib/__init__.py diff --git a/cinder/api/openstack/volume/contrib/admin_actions.py b/cinder/api/contrib/admin_actions.py similarity index 100% rename from cinder/api/openstack/volume/contrib/admin_actions.py rename to cinder/api/contrib/admin_actions.py diff --git a/cinder/api/openstack/volume/contrib/extended_snapshot_attributes.py b/cinder/api/contrib/extended_snapshot_attributes.py similarity index 100% rename from cinder/api/openstack/volume/contrib/extended_snapshot_attributes.py rename to cinder/api/contrib/extended_snapshot_attributes.py diff --git a/cinder/api/openstack/volume/contrib/image_create.py b/cinder/api/contrib/image_create.py similarity index 100% rename from cinder/api/openstack/volume/contrib/image_create.py rename to cinder/api/contrib/image_create.py diff --git a/cinder/api/openstack/volume/contrib/quota_classes.py b/cinder/api/contrib/quota_classes.py similarity index 100% rename from cinder/api/openstack/volume/contrib/quota_classes.py rename to cinder/api/contrib/quota_classes.py diff --git a/cinder/api/openstack/volume/contrib/quotas.py b/cinder/api/contrib/quotas.py similarity index 100% rename from cinder/api/openstack/volume/contrib/quotas.py rename to cinder/api/contrib/quotas.py diff --git a/cinder/api/openstack/volume/contrib/types_extra_specs.py b/cinder/api/contrib/types_extra_specs.py similarity index 100% rename from cinder/api/openstack/volume/contrib/types_extra_specs.py rename to cinder/api/contrib/types_extra_specs.py diff --git a/cinder/api/openstack/volume/contrib/types_manage.py b/cinder/api/contrib/types_manage.py similarity index 100% rename from cinder/api/openstack/volume/contrib/types_manage.py rename to cinder/api/contrib/types_manage.py diff --git a/cinder/api/openstack/volume/contrib/volume_actions.py b/cinder/api/contrib/volume_actions.py similarity index 100% rename from cinder/api/openstack/volume/contrib/volume_actions.py rename to cinder/api/contrib/volume_actions.py diff --git a/cinder/api/openstack/volume/contrib/volume_host_attribute.py b/cinder/api/contrib/volume_host_attribute.py similarity index 100% rename from cinder/api/openstack/volume/contrib/volume_host_attribute.py rename to cinder/api/contrib/volume_host_attribute.py diff --git a/cinder/api/openstack/volume/contrib/volume_tenant_attribute.py b/cinder/api/contrib/volume_tenant_attribute.py similarity index 100% rename from cinder/api/openstack/volume/contrib/volume_tenant_attribute.py rename to cinder/api/contrib/volume_tenant_attribute.py diff --git a/cinder/api/extensions.py b/cinder/api/extensions.py index d558d87a6..046434663 100644 --- a/cinder/api/extensions.py +++ b/cinder/api/extensions.py @@ -269,6 +269,20 @@ class ExtensionManager(object): extensions = list(self.cls_list) + # NOTE(thingee): Until we update devstack to have the new location, + # we'll just set replace the old contrib path with the new and preserve + # any other extensions that need to be loaded + old_contrib_path = ('cinder.api.openstack.volume.contrib.' + 'standard_extensions') + new_contrib_path = 'cinder.api.contrib.standard_extensions' + if old_contrib_path in extensions: + LOG.warn(_('osapi_volume_extension is set to deprecated path: %s'), + old_contrib_path) + LOG.warn(_('Please set your flag or cinder.conf settings for ' + 'osapi_volume_extension to: %s'), new_contrib_path) + extensions = [e.replace(old_contrib_path, new_contrib_path) + for e in extensions] + for ext_factory in extensions: try: self.load_extension(ext_factory) diff --git a/cinder/api/openstack/volume/__init__.py b/cinder/api/openstack/volume/__init__.py deleted file mode 100644 index 747015af5..000000000 --- a/cinder/api/openstack/volume/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. diff --git a/cinder/flags.py b/cinder/flags.py index 4b013c650..14ebc35dd 100644 --- a/cinder/flags.py +++ b/cinder/flags.py @@ -140,12 +140,15 @@ global_opts = [ cfg.ListOpt('osapi_volume_ext_list', default=[], help='Specify list of extensions to load when using osapi_' - 'volume_extension option with cinder.api.openstack.' - 'volume.contrib.select_extensions'), + 'volume_extension option with cinder.api.contrib.' + 'select_extensions'), + # NOTE(thingee): default contrib for old and new location for compatibility cfg.MultiStrOpt('osapi_volume_extension', default=[ - 'cinder.api.openstack.volume.contrib.standard_extensions' - ], + 'cinder.api.openstack.volume.contrib.' + 'standard_extensions', + 'cinder.api.contrib.standard_extensions', + ], help='osapi volume extension to load'), cfg.StrOpt('osapi_compute_link_prefix', default=None, diff --git a/cinder/tests/api/openstack/volume/__init__.py b/cinder/tests/api/contrib/__init__.py similarity index 100% rename from cinder/tests/api/openstack/volume/__init__.py rename to cinder/tests/api/contrib/__init__.py diff --git a/cinder/tests/api/openstack/volume/contrib/test_admin_actions.py b/cinder/tests/api/contrib/test_admin_actions.py similarity index 100% rename from cinder/tests/api/openstack/volume/contrib/test_admin_actions.py rename to cinder/tests/api/contrib/test_admin_actions.py diff --git a/cinder/tests/api/openstack/volume/contrib/test_extended_snapshot_attributes.py b/cinder/tests/api/contrib/test_extended_snapshot_attributes.py similarity index 98% rename from cinder/tests/api/openstack/volume/contrib/test_extended_snapshot_attributes.py rename to cinder/tests/api/contrib/test_extended_snapshot_attributes.py index 43490fbc1..9ba1f53f3 100644 --- a/cinder/tests/api/openstack/volume/contrib/test_extended_snapshot_attributes.py +++ b/cinder/tests/api/contrib/test_extended_snapshot_attributes.py @@ -16,7 +16,7 @@ from lxml import etree import webob -from cinder.api.openstack.volume.contrib import extended_snapshot_attributes +from cinder.api.contrib import extended_snapshot_attributes from cinder import exception from cinder import flags from cinder.openstack.common import jsonutils diff --git a/cinder/tests/api/openstack/volume/contrib/test_types_extra_specs.py b/cinder/tests/api/contrib/test_types_extra_specs.py similarity index 99% rename from cinder/tests/api/openstack/volume/contrib/test_types_extra_specs.py rename to cinder/tests/api/contrib/test_types_extra_specs.py index 0a613ccc0..47414d556 100644 --- a/cinder/tests/api/openstack/volume/contrib/test_types_extra_specs.py +++ b/cinder/tests/api/contrib/test_types_extra_specs.py @@ -20,7 +20,7 @@ from lxml import etree import webob -from cinder.api.openstack.volume.contrib import types_extra_specs +from cinder.api.contrib import types_extra_specs from cinder import test from cinder.tests.api.openstack import fakes import cinder.wsgi diff --git a/cinder/tests/api/openstack/volume/contrib/test_types_manage.py b/cinder/tests/api/contrib/test_types_manage.py similarity index 98% rename from cinder/tests/api/openstack/volume/contrib/test_types_manage.py rename to cinder/tests/api/contrib/test_types_manage.py index ddba008d7..9e5be71ad 100644 --- a/cinder/tests/api/openstack/volume/contrib/test_types_manage.py +++ b/cinder/tests/api/contrib/test_types_manage.py @@ -15,7 +15,7 @@ import webob -from cinder.api.openstack.volume.contrib import types_manage +from cinder.api.contrib import types_manage from cinder import exception from cinder import test from cinder.tests.api.openstack import fakes diff --git a/cinder/tests/api/openstack/volume/contrib/test_volume_actions.py b/cinder/tests/api/contrib/test_volume_actions.py similarity index 99% rename from cinder/tests/api/openstack/volume/contrib/test_volume_actions.py rename to cinder/tests/api/contrib/test_volume_actions.py index afb87b494..a2f984e16 100644 --- a/cinder/tests/api/openstack/volume/contrib/test_volume_actions.py +++ b/cinder/tests/api/contrib/test_volume_actions.py @@ -18,7 +18,7 @@ import datetime import uuid import webob -from cinder.api.openstack.volume.contrib import volume_actions +from cinder.api.contrib import volume_actions from cinder import exception from cinder import flags from cinder.openstack.common import jsonutils diff --git a/cinder/tests/api/openstack/volume/contrib/test_volume_host_attribute.py b/cinder/tests/api/contrib/test_volume_host_attribute.py similarity index 100% rename from cinder/tests/api/openstack/volume/contrib/test_volume_host_attribute.py rename to cinder/tests/api/contrib/test_volume_host_attribute.py diff --git a/cinder/tests/api/openstack/volume/contrib/test_volume_tenant_attribute.py b/cinder/tests/api/contrib/test_volume_tenant_attribute.py similarity index 100% rename from cinder/tests/api/openstack/volume/contrib/test_volume_tenant_attribute.py rename to cinder/tests/api/contrib/test_volume_tenant_attribute.py diff --git a/cinder/tests/api/openstack/volume/contrib/__init__.py b/cinder/tests/api/openstack/volume/contrib/__init__.py deleted file mode 100644 index 3be5ce944..000000000 --- a/cinder/tests/api/openstack/volume/contrib/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# Copyright 2011 OpenStack LLC. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -# NOTE(vish): this forces the fixtures from tests/__init.py:setup() to work -from cinder.tests import * -- 2.45.2