Move calculating new capacity to a function

This is part of the refactoring to fix the
inheritance hierarchy of AutoScaleResourceGroup.
In this case, attempting to move some common
functionality out of the inheritance hierarchy
entirely (perhaps to the heat/scaling module).

Calculating the new capacity while taking
min/max constraints into account, seems like
some common functionality to any type of
scaling.  This way, the extra bounds checking
in handle_update can be eliminated as well.

Change-Id: I0f4c78df15d3d973394ccfa14178941d170c9944
Change Volume metadata attribute to raw dict.

Currently the volume metadata attribute is json
serialized, but outputting the raw dict is more
convenient for human users. This is fixed by
introducing a new attribute 'metadata_values'
whose output is in raw dict form. The attribte
'metadata' is preserved for those users who are
already used to its json serialized output.

Change-Id: Ib95656fa8632449957cd8c24b232f4d1b09a0e42
Closes-Bug: #1322007
Refactor service readiness notification

Build upon cceda95a35f18f5f7b52daaf0662a4cd3768b3ac apply Oslo systemd
module. It was imported in aef33d2d716c064f1f571c334fd36b1ea5928d5c. It
also drops heat.common.systemd and deprecates onready configuration
parameter.

Oslo commit 53e1214c092f09e3851b1a1b55289a93a72b09ec

Change-Id: I80f325c9be9c171c2dc8d5526570bf64f0f87c78
Remove unused functions from policy enforcer

The policy.Enforcer class has two functions which we don't use
anywhere, and the check function is broken due to an argument
mismatch with _check, so remove them until such time as they
are actually needed.

Change-Id: I25199fffeed5905b0673f137c70720ddb6dc48cb
Set python hash seed to 0 in tox.ini

New tox (>=1.7.0) sets a random python hash seed by default. This is
generally good for testing because it will help keep projects working
regardless of the hash seed, but heat unittests don't currently pass
with a random hash seed so set it to the python default seed.

This change will allow us to use new tox again and remove the
restriction on tox<=1.6.1 to run unittests.

Redundant setenvs for specific test envs are removed to prevent them
from overriding the PYTHONHASHSEED value.

Note this change will need to be backported to the stable branches to
keep unittests there working with new tox as well.

Change-Id: I2370759546adee7bf5e20fa214ed7fa1f31d6bfe
Parse RST in plug-in class docs

In order to make the generated documentation for resource plug-ins more
readable, parse the class comments as RST and append to the section.

Change-Id: Icb37344c64c21bcac536e8f2916b102eb9754851
Add "index_var" property to the resource group resource

This property allows a template author to replace values in the
nested resource_ref with the index of the specific instance of
that resource in the group. This allows a user to, for example,
add the index of the resource to server names in order to make
them more easily distinguishable when listed outside of Heat.

Implemements: blueprint override-resource-name-in-resource-group
Change-Id: I4339067e3b8927573acff0ab5968de61a3253d07
Add RPC method to snapshot stacks

This adds new methods to snapshot a stack and manipulates snapshots.

blueprint stack-snapshot
Co-Authored-By: ala.rezmerita@cloudwatt.com

Change-Id: Id3dafef3c2c04cd43c3094283dceece26834a5e1
Add log output about HTTP calls in cinderclient

This patch enables heat to output the details of requests
to cinder and responses from cinder
(including 'x-openstack-request-id' in the response header)
to the log.

Change-Id: I714c87e538bc3a51dce6a48e584824cf7f954bcf
Closes-bug: #1329613
Show correct error messages

When a ResourceFailure exception raised in heat/engine/stack.py,
the error message is not correctly printed. This patch fixes it.

Change-Id: I0636b0d14f0169117fe96df7a4360b1349f7b12d
Fix dead link in cfn template doc

The link referenced in templates/cfn/WordPress_Single_Instance
is dead. Looks like the directory was restructured. Updated using
a like for the F18 version of the template.

Change-Id: I46705cd31e2be6f3f131c64944665eabe6347dc9
Always convert string type params to string

Schema.to_schema_type() should convert values passed to it to the
appropriate type.  So if the user passed a version number of 9.4 and
they defined it in the template with a string type, we should get the
string '9.4' back, instead of the error "The value '9.4' is invalid for
type 'string'".

Co-Authored-By: Richard Lee <rblee88@gmail.com>
Closes-Bug: #1353701
Change-Id: If7abd129dc7819c6ac01f9bf7dfdbe397ec09c65
Improve mocking in HeatTestCase

As the mock lib is going to be used more actively, there is a need
to improve our boilerplate code in respect to mock.

Changes in this patch include:
* `patchobject` now accepts kwargs and passes them to `mock.patch.object`;
* added `patch` method that uses mock.patch (similar to `patchobject`)
  - NOTE: this shadows `testtools.TestCase.patch` method that uses
    simple monkey-patching in favor of mock-based patching,
    relevant comment added in the code;
* test code changed accordingly where needed.

Change-Id: I779cab63249d5eb1962e9ec388cd31f3df4a4189
Fix monkey-patching occurence in a test

A test of Resource class was using a direct monkey-patching of a
generic resource class without cleanup. This has not resulted in an error
so far, but surely might in the future.

This patch uses proper mock for patching instead.

Change-Id: I9134dfc625e12df1ebcacda8373f81737fd59c2c
Add config file for performance gate job

This job is called gate-rally-dsvm-fakevirt-heat.
Also added readme and plugin sample.

Change-Id: Ic4f482e566f3552b3fdf7129b8447e7def036441
Merge "Refactor service readiness notification"
Add `immutable` property attribute

Currently resources support only in-place update or (default)
UpdateReplace. In order to support AWS "Updates are not supported"
feature, this new property attribute is added, with default value False.
It is going to be used for denying an UpdateReplace
behavior of the resource (similar to update_allowed currently).

Change-Id: Ie94241630d9595b58ff6b84bcb94459b0785fc03
Implements: blueprint implement-aws-updates-not-supported
Check for property immutability in rsrc update

This patch adds check during resource update that the updated property
is not `immutable`. Otherwise update raises NotSupported error and
resource update fails.

Change-Id: I91019cb34adfcbe67d8c802d4ce1ff7702656a7c
Implements: blueprint implement-aws-updates-not-supported
Amend docs with `immutable` property attribute.

Include warning about updates not being supported for a propety
based on its `immutable` value being True.

Change-Id: I10fe495a2a35429b3d6e254c23ae91732e2e4dd8
Implements: blueprint implement-aws-updates-not-supported
Deny updates to AWS::EC2::Volume resource

According to AWS docs [1] Volume resource does not support updates
(including resource replacement) of any of its properties.
To align our AWS-compatible resource with such behavior, all properties
of AWS::EC2::Volume resource are marked as immutable.

[1] http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html

Change-Id: I7fea68f11c58d395c1eb31fae834afcab5dc4d1e
Closes-Bug: #1340093