]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Moving contrib to cinder.api
authorMike Perez <thingee@gmail.com>
Tue, 13 Nov 2012 05:13:55 +0000 (21:13 -0800)
committerMike Perez <thingee@gmail.com>
Thu, 22 Nov 2012 05:26:40 +0000 (21:26 -0800)
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

23 files changed:
cinder/api/contrib/__init__.py [moved from cinder/api/openstack/volume/contrib/__init__.py with 100% similarity]
cinder/api/contrib/admin_actions.py [moved from cinder/api/openstack/volume/contrib/admin_actions.py with 100% similarity]
cinder/api/contrib/extended_snapshot_attributes.py [moved from cinder/api/openstack/volume/contrib/extended_snapshot_attributes.py with 100% similarity]
cinder/api/contrib/image_create.py [moved from cinder/api/openstack/volume/contrib/image_create.py with 100% similarity]
cinder/api/contrib/quota_classes.py [moved from cinder/api/openstack/volume/contrib/quota_classes.py with 100% similarity]
cinder/api/contrib/quotas.py [moved from cinder/api/openstack/volume/contrib/quotas.py with 100% similarity]
cinder/api/contrib/types_extra_specs.py [moved from cinder/api/openstack/volume/contrib/types_extra_specs.py with 100% similarity]
cinder/api/contrib/types_manage.py [moved from cinder/api/openstack/volume/contrib/types_manage.py with 100% similarity]
cinder/api/contrib/volume_actions.py [moved from cinder/api/openstack/volume/contrib/volume_actions.py with 100% similarity]
cinder/api/contrib/volume_host_attribute.py [moved from cinder/api/openstack/volume/contrib/volume_host_attribute.py with 100% similarity]
cinder/api/contrib/volume_tenant_attribute.py [moved from cinder/api/openstack/volume/contrib/volume_tenant_attribute.py with 100% similarity]
cinder/api/extensions.py
cinder/api/openstack/volume/__init__.py [deleted file]
cinder/flags.py
cinder/tests/api/contrib/__init__.py [moved from cinder/tests/api/openstack/volume/__init__.py with 100% similarity]
cinder/tests/api/contrib/test_admin_actions.py [moved from cinder/tests/api/openstack/volume/contrib/test_admin_actions.py with 100% similarity]
cinder/tests/api/contrib/test_extended_snapshot_attributes.py [moved from cinder/tests/api/openstack/volume/contrib/test_extended_snapshot_attributes.py with 98% similarity]
cinder/tests/api/contrib/test_types_extra_specs.py [moved from cinder/tests/api/openstack/volume/contrib/test_types_extra_specs.py with 99% similarity]
cinder/tests/api/contrib/test_types_manage.py [moved from cinder/tests/api/openstack/volume/contrib/test_types_manage.py with 98% similarity]
cinder/tests/api/contrib/test_volume_actions.py [moved from cinder/tests/api/openstack/volume/contrib/test_volume_actions.py with 99% similarity]
cinder/tests/api/contrib/test_volume_host_attribute.py [moved from cinder/tests/api/openstack/volume/contrib/test_volume_host_attribute.py with 100% similarity]
cinder/tests/api/contrib/test_volume_tenant_attribute.py [moved from cinder/tests/api/openstack/volume/contrib/test_volume_tenant_attribute.py with 100% similarity]
cinder/tests/api/openstack/volume/contrib/__init__.py [deleted file]

index d558d87a623a49bb2a13a37eca39ff46b1fb5863..046434663993516424c8315a93ed4afd9745a8dd 100644 (file)
@@ -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 (file)
index 747015a..0000000
+++ /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.
index 4b013c65035370b9199036371b776a360680e914..14ebc35dda0b8def61334251333cf0533ec773e4 100644 (file)
@@ -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,
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 43490fbc19f135eec27d7c85d1cf9b0f45fc1348..9ba1f53f32b8947b9fc4147a5a7041c87954b0b0 100644 (file)
@@ -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
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 0a613ccc0a792bd7d52cac0fa3c8b60750a4b453..47414d556a0995e90b975f47551f008c5b5c6ca3 100644 (file)
@@ -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
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 ddba008d79d27616b39b1ed08088169549fd7cac..9e5be71ad5627405ef9cadfb924cf3a76d1dcbf2 100644 (file)
@@ -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
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 afb87b494f627bdf4ec781acf044e0b766dc6a38..a2f984e16ed0507efe102563a8de3f8cd28a2641 100644 (file)
@@ -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/__init__.py b/cinder/tests/api/openstack/volume/contrib/__init__.py
deleted file mode 100644 (file)
index 3be5ce9..0000000
+++ /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 *