diff --git a/contrib/cinder_volume_type/README.md b/contrib/cinder_volume_type/README.md deleted file mode 100644 index f89258137e..0000000000 --- a/contrib/cinder_volume_type/README.md +++ /dev/null @@ -1,49 +0,0 @@ -Cinder volume_type plugin for OpenStack Heat -============================================ - -This plugin enables using Cinder volume_types as resources in a Heat template. - - -### 1. Install the Cinder volume_type plugin in Heat - -NOTE: These instructions assume the value of heat.conf plugin_dirs includes the -default directory /usr/lib/heat. - -To install the plugin, from this directory run: - sudo python ./setup.py install - -### 2. Restart heat - -Only the process "heat-engine" needs to be restarted to load the new installed -plugin. - -### Template Format - -Here's an example cinder volume_type and cinder volume resources: -```yaml -heat_template_version: 2013-05-23 -description: Heat Cinder creation with volume_type example -resources: - my_volume_type: - type: OS::Cinder::VolumeType - properties: - name: volumeBackend - metadata: {volume_backend_name: lvmdriver} - my_volume: - type: OS::Cinder::Volume - properties: - size: 1 - volume_type: {get_resource: my_volume_type} -``` - -### Issues with the Cinder volume_type plugin - -By default only users who have the admin role can manage volume -types because of the default policy in -Cinder: ```"volume_extension:types_manage": "rule:admin_api"``` - -To let the possibility to all users to create volume type, the rule must be -replaced with the following: ```"volume_extension:types_manage": ""``` - -The following error occurs if the policy has not been correctly set: - ERROR: Policy doesn't allow volume_extension:types_manage to be performed. \ No newline at end of file diff --git a/contrib/cinder_volume_type/cinder_volume_type/__init__.py b/contrib/cinder_volume_type/cinder_volume_type/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/contrib/cinder_volume_type/cinder_volume_type/resources/__init__.py b/contrib/cinder_volume_type/cinder_volume_type/resources/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/contrib/cinder_volume_type/cinder_volume_type/tests/__init__.py b/contrib/cinder_volume_type/cinder_volume_type/tests/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/contrib/cinder_volume_type/setup.cfg b/contrib/cinder_volume_type/setup.cfg deleted file mode 100644 index 2771554ede..0000000000 --- a/contrib/cinder_volume_type/setup.cfg +++ /dev/null @@ -1,27 +0,0 @@ -[metadata] -name = heat-contrib-cinder-volume-type -summary = Heat resource for managing cinder volume_types -description-file = - README.md -author = OpenStack -author-email = openstack-dev@lists.openstack.org -home-page = http://www.openstack.org/ -classifier = - Environment :: OpenStack - Intended Audience :: Information Technology - Intended Audience :: System Administrators - License :: OSI Approved :: Apache Software License - Operating System :: POSIX :: Linux - Programming Language :: Python - Programming Language :: Python :: 2 - Programming Language :: Python :: 2.7 - Programming Language :: Python :: 2.6 - -[files] -# Copy to /usr/lib/heat for plugin loading -data_files = - lib/heat/cinder_volume_type = cinder_volume_type/resources/* - -[global] -setup-hooks = - pbr.hooks.setup_hook diff --git a/contrib/cinder_volume_type/setup.py b/contrib/cinder_volume_type/setup.py deleted file mode 100644 index 62f38a592f..0000000000 --- a/contrib/cinder_volume_type/setup.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env python -# -# 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. - -# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT -import setuptools - -# In python < 2.7.4, a lazy loading of package `pbr` will break -# setuptools if some other modules registered functions in `atexit`. -# solution from: http://bugs.python.org/issue15881#msg170215 -try: - import multiprocessing # noqa -except ImportError: - pass - -setuptools.setup( - setup_requires=['pbr'], - pbr=True) diff --git a/contrib/cinder_volume_type/cinder_volume_type/resources/cinder_volume_type.py b/heat/engine/resources/openstack/cinder/cinder_volume_type.py similarity index 81% rename from contrib/cinder_volume_type/cinder_volume_type/resources/cinder_volume_type.py rename to heat/engine/resources/openstack/cinder/cinder_volume_type.py index 735fb05aea..2a45163b89 100644 --- a/contrib/cinder_volume_type/cinder_volume_type/resources/cinder_volume_type.py +++ b/heat/engine/resources/openstack/cinder/cinder_volume_type.py @@ -19,11 +19,28 @@ from heat.engine import support class CinderVolumeType(resource.Resource): """ - A resource for creating OpenStack virtual hardware templates. + A resource for creating cinder volume types. Note that default cinder security policy usage of this resource is limited to being used by administrators only. + + Here is an example cinder volume_type and cinder volume resources:: + + heat_template_version: 2013-05-23 + description: Heat Cinder creation with volume_type example + resources: + my_volume_type: + type: OS::Cinder::VolumeType + properties: + name: volumeBackend + metadata: {volume_backend_name: lvmdriver} + my_volume: + type: OS::Cinder::Volume + properties: + size: 1 + volume_type: {get_resource: my_volume_type} """ + support_status = support.SupportStatus(version='2015.1') PROPERTIES = ( diff --git a/contrib/cinder_volume_type/cinder_volume_type/tests/test_cinder_volume_type.py b/heat/tests/test_cinder_volume_type.py similarity index 86% rename from contrib/cinder_volume_type/cinder_volume_type/tests/test_cinder_volume_type.py rename to heat/tests/test_cinder_volume_type.py index 45a296b5c2..c71e3d8a5c 100644 --- a/contrib/cinder_volume_type/cinder_volume_type/tests/test_cinder_volume_type.py +++ b/heat/tests/test_cinder_volume_type.py @@ -13,15 +13,12 @@ import mock -from heat.engine import resource +from heat.engine.resources.openstack.cinder import cinder_volume_type from heat.engine import stack from heat.engine import template from heat.tests import common from heat.tests import utils -from ..resources.cinder_volume_type import CinderVolumeType # noqa -from ..resources.cinder_volume_type import resource_mapping # noqa - volume_type_template = { 'heat_template_version': '2013-05-23', 'resources': { @@ -42,10 +39,6 @@ class CinderVolumeTypeTest(common.HeatTestCase): self.ctx = utils.dummy_context() - # For unit testing purpose. Register resource provider - # explicitly. - resource._register_class('OS::Cinder::VolumeType', CinderVolumeType) - self.stack = stack.Stack( self.ctx, 'cinder_volume_type_test_stack', template.Template(volume_type_template) @@ -59,10 +52,12 @@ class CinderVolumeTypeTest(common.HeatTestCase): self.volume_types = self.cinderclient.volume_types def test_resource_mapping(self): - mapping = resource_mapping() + mapping = cinder_volume_type.resource_mapping() self.assertEqual(1, len(mapping)) - self.assertEqual(CinderVolumeType, mapping['OS::Cinder::VolumeType']) - self.assertIsInstance(self.my_volume_type, CinderVolumeType) + self.assertEqual(cinder_volume_type.CinderVolumeType, + mapping['OS::Cinder::VolumeType']) + self.assertIsInstance(self.my_volume_type, + cinder_volume_type.CinderVolumeType) def test_volume_type_handle_create(self): value = mock.MagicMock()