Patch 044 migration to work w/ MySQL 5.6

With MySQL 5.6 setup to use UTF-8 for everything, the 044 migration
will fail. This is because a VARCHAR(256) cannot be indexed in UTF-8
databases. In versions of MySQL before 5.6, this produced a warning and
a truncated, less-useful index. In 5.6 it was changed to an error.

We will reduce these columns further to 64 bytes in the model in a
subsequent fix. For now, we will just create the table with 64 character
columns on new systems, which will allow this migration to work properly
on mysql-5.6. There is no danger of overflow, as 64 chars is what Keystone
uses for them anyway.

Change-Id: I73932f69ff662ef5bb030b6516bd3d32507de658
Related-Bug: #1316646
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
Fixed resource errors logged at default log level

* Heat was logging resource failures traceback at default log level.

* Resources failing is a normal condition, and once a resource has failed,
heat has already reached one of the permissible state ex: CREATE_FAILED,
hence heat should not log the resource failures traceback in default log
level.

* Have made necessary changes to log resource failures traceback at INFO
level.

Change-Id: Ica27cac5a94734c2db08cee2e7fe31289169fec9
Closes-Bug: #1290565
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
Fix signal handling for WSGI servers

Previously, sending a SIGHUP to the parent process would close the
shared socket used with all the WSGI servers (problematic when multiple
workers are present). Also, exiting the wait loop in the parent would
cause the children to be orphaned. Instead, make the parent process
restart all the children servers upon receipt of SIGHUP. This behavior
seems to make sense given that sending SIGHUP to a child restarts and
creates a new server (due to the parent handling of the children).

Another fix was to issue a SIGTERM upon Ctrl-C in order to not leave
parentless children. SIGTERM was chosen instead of SIGINT simply to
avoid worker tracebacks on the terminal.

Minor unrelated change: the WSGI server in single worker mode has been
changed to also respect the debug flag, exactly the same as with
multiple workers.

Note: the original bug report was examining lack of signal handling
based on the Oslo service code. However, only the engine makes use of
it.

Change-Id: I8519cc6fedf72b38a8ce0762bb86cd70e58e0dc7
Closes-bug: #1276694
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
Add controller and action debug message in wsgi.py

Add controller and action debug message before calling api
controller to provide much more debug message when debugging api.

Change-Id: Ia1d05a3fd3574a63571838b6eb60f4db5bfef7f4
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
Implement custom constraints for subnet/port/router

Implement custom constraints for subnet/port/router

blueprint neutron-custom-constraint
Change-Id: I2d463512b0c19bd02ef0629a38a97dddfd4a1cfe
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