Use region for cinder management uri

Make the cinder client region-aware since Rackspace supports
more that one and needs to know in which region to deploy
volumes.

Closes-Bug: #1268706
Change-Id: Ibf7cf4fbabd1e11f798423b9ad2698e43cd46687
Adding Range constraint for SIZE property

Change-Id: Ie051a87df36632a1adf36f05ffb0a05d9115337f
Closes-bug: #1267747
Enable better sub-classing of common Schema class

This patch is first in a series of patches to unify the code for
property and parameter validation based on a common Schema class.

The current patch refactors the existing Schema class in
constraints.py so it will in a subsequent patch be easier to
sub-class it, i.e. to rebase the parameters schema class on it.

For example, sub-classes will be able to override uppercase/
lowercase spelling of data type names etc., which will save us
translation between CFN and HOT specifics in the engine.

Change-Id: I0418a00f045af590b17500716a74b8cc6ff72409
Partial-Bug: #1230229
Implements: blueprint schema-code-consolidation
Add a new "UpdateWaitConditionHandle" resource

On Update, the WaitConditions are not waited on if the count of unique ids
have already been satisfied before. If you have a setup which is watching
for changes and re-sending the signals then, it simplifies things for
the stack update to wait for these to be completed before moving on.

Change-Id: Ibfadc6f9c436ce3d0f468a4e5560233f762038dd
Remove dependencies on pep8, pyflakes and flake8

Hacking already pins them to the compatible versions,
so avoid running out of sync by letting hacking
determine the correct code checker versions.

Change-Id: I22151423b7884428d71de364ea81d6ec0a1fdafa
Fix order of arguments in assertEqual (patch 2/2)

Some tests used incorrect order assertEqual(observed, expected).

The correct order expected by testtools is
assertEqual(expected, observed).

This patch includes the other half of the files touched by these changes
(starting from test_n* plus contrib code) to ease the review.

Change-Id: I870386871581980abd796304dd91be0c662cb73e
Partial-Bug: #1259292
Make endpoint_type configurable

Allow to specify the endpoint type to use. Not everybody will
want to use publicURL, so let's make this configurable.

Closes-Bug: #1191109
Change-Id: I6f59fded9f9b70fd638ff17ed9fd4d7733cefac5
Database model for software config/deployment

These database tables act as storage to SoftwareConfig
and SoftwareDeployment entities which are exposed via the
heat REST API.

There is no software_config_update as software config entities
are immutable after creation. This allows them to be created
outside any stack which uses them, and used by reference without
being concerned about their contents changing over time.

Implements: blueprint hot-software-config-rest
Change-Id: I9ff17f48dcd9605ff76f81007c559596234eac6e
Ignore tox -e cover generated files

The generated files are like '.coverage.idlerk.5365.021771', which can
not matched by '.coverage'. So change it to '.coverage.*'

Change-Id: Ie0bebceaaa15f2dcf145a708300654f8d3605271
Refactor heat gate testing contrib support

The existing code is running tests twice, one for heat, one for
contrib via adding two commands in tox.

This breaked tox single run. For example:

  tox -e py27 -- heat.tests.test_software_config

Except heat.tests.test_software_config is executed, all test cases in
contrib will be executed also.

The patch added contrib in discover list, which can make sure both
contrib in heat gate testing and does not break single test run.

Change-Id: I014d7b95c64287e1fd04a0ba69fce0de554a9a08
Fix adding heat_stack_user role via v3 API

A regression was introduced via 301a894 because it expects
keystoneclient functionality which is not yet merged/released,
so instead of passing the name to roles.list() we must filter
the results locally to lookup the role ID.

The lack of filtering support is a general issue with the v3
keystoneclient interfaces, so when it's fixed we can remove
this workaround.

Closes-Bug: #1271190
Change-Id: I1b29cc131496e4b19493a8cd8e6d4ed913db0938
Fix error in RS Auto Scale properties schema

The Rackspace Auto Scale resource's server networks property should be a
list of maps, not a map of strings.  The property description states
that the it is "Networks to attach to", so the property must be a list.

Change-Id: I6c53a895a820b934f2df7ead0f5732a636a4399d
Closes-Bug: #1270922
Always specify preserve_ephemeral on server rebuild

Heat unit tests currently fail with git master novaclient. Without
this change all heat gating will fail as soon as novaclient 2.16.0 is
released.

Ideally the test mox should handle preserve_ephemeral being specified or not
but it is not obvious that this is possible. Novaclient rebuild has a kwargs
so always specifying preserve_ephemeral should not have any issues with
older novaclient.

Change-Id: Ieba9d19fefa77faf91b1d55bfbaa6797aeaa1fee
Closes-Bug: #1271367
Implement adopt-stack

Create a stack using user specified, already existing external
resources. The user specifies what resources to adopt using the
same serialization format as the one produced by abandon-stack.

Change-Id: I87b6d94780651143cd61fe95ee083e4310ad59c8
Implements: blueprint adopt-stack
Implement adopt-stack for nested stacks

Create a nested stack using user specified, already existing
external resources.

Change-Id: I3f4473dd6fbadff4267ec06db04422f9dd12b8c1
Implements: blueprint adopt-stack
add the validation of MaxSize ,MinSize and DesiredCapacity

* check whether MinSize is less than MaxSize
* check whether MinSize and MaxSize is not less than 0
* if DesiredCapacity is offered,check whether it is between
  MinSize and MaxSize

Change-Id: I79a7b6c0e61f109ac7e71d3fd48d93fb741bbc64
Closes-Bug: #1270070
Make LB-updating in rolling update more reliable

The rolling update code updates the load balancer when instances
are being updated (and thus out of service). It determines which instances
are being changed by comparing the str() of the templates. Unfortunately,
str() of dicts in Python returns keys in an unreliable order, depending on
the way the dicts were constructed. Therefore, sometimes rolling updates
would erroneously determine that instances were changing when they were not,
and take them out of service in the load balancer.

This patch contains no additional tests because it's not really possible to
reliably reproduce this across multiple platforms. Existing tests will fail if
the erroneous case is triggered.

Change-Id: Icb564a65ca118a2fc84d7df8c44330281074bbb7
Closes-Bug: #1271397
Merge "Always specify preserve_ephemeral on server rebuild"
Merge "add the validation of MaxSize ,MinSize and DesiredCapacity"
"version" section should be required in template

"HeatTemplateFormatVersion" as default while a template missing version
section now in heat. But then the server can't parse the template in right
way, not translate hot format to cfn. Some errors raised such as:
  Error : At least one Resources member must be defined.
  but "resources" section has one resource.
  Error: The Parameter (image_id) was not defined in template.
  but "image_id" was defined in "parameter" section.

So if we cannot determine the template version, we should raise an
exception. This patch will check whether version section is in template,
if not we should raise exception.

Change-Id: Idc2ba2b9ae099d4509dfd81914aa9bb8bd3bfefb
Closes-Bug: #1267735