Move nova_flavor resource in-tree
This change relocates the nova_flavor resource from the contrib area into the main resource tree. Change-Id: Ib1035750f7e364a81b1190db4d414f50707c875b
This commit is contained in:
parent
b02805bea5
commit
ea2bde776f
|
@ -1,58 +0,0 @@
|
|||
Nova Flavor plugin for OpenStack Heat
|
||||
=====================================
|
||||
|
||||
This plugin enables using Nova Flavors as resources in a Heat template.
|
||||
|
||||
Note that the current implementation of the Nova Flavor resource does not
|
||||
allow specifying the name and flavorid properties for the resource.
|
||||
This is done to avoid potential naming collision upon flavor creation as
|
||||
all flavor have a global scope.
|
||||
|
||||
### 1. Install the Nova Flavor 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 nova flavor resource:
|
||||
```yaml
|
||||
heat_template_version: 2013-05-23
|
||||
description: Heat Flavor creation example
|
||||
resources:
|
||||
test_flavor:
|
||||
type: OS::Nova::Flavor
|
||||
properties:
|
||||
ram: 1024
|
||||
vcpus: 1
|
||||
disk: 20
|
||||
swap: 2
|
||||
extra_specs: {"quota:disk_read_bytes_sec": "10240000"}
|
||||
```
|
||||
|
||||
### Issues with the Nova Flavor plugin
|
||||
|
||||
By default only the admin tenant can manage flavors because of the default
|
||||
policy in Nova: ```"compute_extension:flavormanage": "rule:admin_api"```
|
||||
|
||||
To let the possibility to all tenants to create flavors, the rule must be
|
||||
replaced with the following: ```"compute_extension:flavormanage": ""```
|
||||
|
||||
The following error occurs if the policy has not been correctly set:
|
||||
ERROR: Policy doesn't allow compute_extension:flavormanage to be performed.
|
||||
|
||||
Currently all nova flavors have a global scope, which leads to several issues:
|
||||
1. Per-stack flavor creation will pollute the global flavor list.
|
||||
2. If two stacks create a flavor with the same name collision will occur,
|
||||
which will lead to the following error:
|
||||
|
||||
ERROR (Conflict): Flavor with name dupflavor already exists.
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
[metadata]
|
||||
name = heat-contrib-nova-flavor
|
||||
summary = Heat resource for managing nova flavors
|
||||
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/nova_flavor = nova_flavor/resources/*
|
||||
|
||||
[global]
|
||||
setup-hooks =
|
||||
pbr.hooks.setup_hook
|
|
@ -1,30 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# 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)
|
|
@ -14,6 +14,7 @@
|
|||
from heat.common.i18n import _
|
||||
from heat.engine import properties
|
||||
from heat.engine import resource
|
||||
from heat.engine import support
|
||||
|
||||
|
||||
class NovaFlavor(resource.Resource):
|
||||
|
@ -28,8 +29,24 @@ class NovaFlavor(resource.Resource):
|
|||
allow specifying the name and flavorid properties for the resource.
|
||||
This is done to avoid potential naming collision upon flavor creation as
|
||||
all flavor have a global scope.
|
||||
|
||||
Here is an example nova flavor resource::
|
||||
|
||||
heat_template_version: 2013-05-23
|
||||
description: Heat Flavor creation example
|
||||
resources:
|
||||
test_flavor:
|
||||
type: OS::Nova::Flavor
|
||||
properties:
|
||||
ram: 1024
|
||||
vcpus: 1
|
||||
disk: 20
|
||||
swap: 2
|
||||
extra_specs: {"quota:disk_read_bytes_sec": "10240000"}
|
||||
"""
|
||||
|
||||
support_status = support.SupportStatus(version='2014.2')
|
||||
|
||||
PROPERTIES = (
|
||||
RAM, VCPUS, DISK, SWAP, EPHEMERAL,
|
||||
RXTX_FACTOR, EXTRA_SPECS,
|
|
@ -13,15 +13,13 @@
|
|||
|
||||
import mock
|
||||
|
||||
from heat.engine import resource
|
||||
from heat.engine.resources.openstack.nova import nova_flavor
|
||||
from heat.engine import stack
|
||||
from heat.engine import template
|
||||
from heat.tests import common
|
||||
from heat.tests.nova import fakes
|
||||
from heat.tests import utils
|
||||
|
||||
from ..resources import nova_flavor # noqa
|
||||
|
||||
flavor_template = {
|
||||
'heat_template_version': '2013-05-23',
|
||||
'resources': {
|
||||
|
@ -47,10 +45,6 @@ class NovaFlavorTest(common.HeatTestCase):
|
|||
|
||||
self.ctx = utils.dummy_context()
|
||||
|
||||
# For unit testing purpose. Register resource provider
|
||||
# explicitly.
|
||||
resource._register_class("OS::Nova::Flavor", nova_flavor.NovaFlavor)
|
||||
|
||||
self.stack = stack.Stack(
|
||||
self.ctx, 'nova_flavor_test_stack',
|
||||
template.Template(flavor_template)
|
Loading…
Reference in New Issue