Fix status reason in events for deployment signals

When a signal is received and processed by a Resource, there could be an
event generated automatically. For such an event, Heat is supposed to
provide some useful message (including status_reason).  But currently,
the resource code can only process ceilometer alarms and watch rules,
for signals sent for a SoftwareDeployment resource, the signal is only
providing an string 'Unknown' as the status change reason.  This is
confusing when a user performs 'heat event-list stack'.

This patch adds an additional check (guess) whether the signal comes
from a SoftwareDeployment.  If that is the case, fill in the status
reason as 'deployment succeeded', or 'deployment failed (n)', where n is
the deploy_status_code that comes with the signal.

Closes-Bug: #1300679
Change-Id: Ic970a5dac923fffdcdd365983df58f4d338de849
Refined schema for VPCZoneIdentifier

The schema now says it is a list of strings. Also upgraded the
description.  Also clarified the name of
test_invalid_vpc_zone_identifier.

Change-Id: I4b17dbd146965df3df3f4205dddafc0b65061294
Closes-Bug: #1294717
Fix delete event error in postgres

An error happens when heat delete events in postgres,
 It seems that JOIN/DELETE is not supported in
"sqlalchemy/orm/".

Let heat delete events in postgres in the common
way.

Closes-Bug: #1301827
Change-Id: Id320abf15c4fd9f58e411ad7de7f044a9b5d1c1e
Validate user_data_format for server with deployment

Validation error will be raised if user_data_format is not set
correctly.

Partial-Bug: #1295536
Change-Id: I0509c9c3a71d09fa8e2113710d561ffd3289d814
Enable lazy translation in unit tests

Change-Id: Ia2aaaaae34f0f234b2493e7c724d7b874035bcfb
Check that all po/pot files are valid

Perform minimal checks on po and pot files so that no broken files can
get imported.

Change-Id: Ib438faddb362eb8e61eaa64a870160196f16c594
Related-Bug: #1299349
Co-Authored-By: Clark Boylan <clark.boylan@gmail.com>
Move API parameter parsing from engine to API

API parameter parsing should be done in the API rather than the engine.

Change-Id: I133f419bbb73964b461572d8cadd300233af9c12
Catch NotFound for keystone delete operations

If heat-engine is terminated mid-delete, a stack could become
undeletable because of NotFound exceptions being raised on keystone
delete stack domain operations.

This change wraps all keystone delete calls and ignores any NotFound
exceptions raised.

Change-Id: I032b04b1391590a6f9493b65bddff331b07722f0
Closes-Bug: #1308812
Change volume size property type to integer

Before it was possible to provide a rational number for SIZE, but cinder
would silently round it down, which leads to inconsistency between
stored resource state and actual cinder volume.

Closes-Bug: #1311707
Change-Id: I97b110f9797e2046bd5d2ae7da227b8dfc19059a
Fix validate failed with an image_name in uuid format

We should support to get the image_id by an image_name which is in uuid
format.

Change-Id: I471ee57ea55f990f852398a43762899dbc3d8692
Closes-Bug: #1312523
Remove unused logger

There are a lot of files contain import logging which is used for
creating logger object. However in some files we only have definition of
logger without using him. In this patch all unused loggers and imports
are deleted.

Change-Id: Iedba6d40850cb050c5c25d9b8a6a1d7128fd4bee
Update openstack-common in prep for graceful stop

Now at oslo-incubator version 95c7598917c7cd16f68a253a2048c21b3df9dfda

Change-Id: I2655ba2b9a0fb5048576f2b738d2af52c76c1d05
Partial-Bug: #1304244
Make events return by insertion order

We fixed the table by having the ID available, but the query uses an
index, so MySQL will return the rows in index order, which is not
necessarily primary key order. We need to explicitly ask that it be
returned in primary key order. This should be a free operation on MySQL.

Change-Id: I48d6260e01736fc7475c13cf736968dbf8eda206
Order and separate imports properly

Alphabetical and separated into system modules and libs.

Change-Id: I367245b10ca428d68350e3f010c17dea7e38fe67
Fix all flake8 problems.

Change-Id: Ibd36add2530a144122a0c3a88f31b3df1b838d24
Distribute create_heat_domain

Rename it to heat-keystone-setup-domain and ship it in bin with the
other helper scripts. This will make it consumable by automated systems
and packaging.

Change-Id: I7914869377cd08b6201007aa0eb6b8a70d763254
An IO optimised method for accessing resource data

This provides a wrapper over the db_api.resource_data_* methods that
attempts to avoid unnecessary database calls for get operations.

On resource create, all resource data is loaded with a single query and
stored with the resource as a dict. Calling data_set() or data_delete()
clears this dict so the next time data() is called all resource
data is loaded again from the database.

There is a future potential optimisation to prefetch the resource.data on
resource_get_by_name_and_stack, which would result in zero resource data
queries for a Stack.load.

This is part of an effort to reduce the number of database queries required
for a Stack.load operation.

Change-Id: I2564a9f953841d895acd5b853a67aa4bc375b635
Related-Bug: #1306743
Port all resources to new resource data methods

Change-Id: I9f7e984f5224cee16a2ffd3e9d6b118304766701
Related-Bug: #1306743
Prefetch data in resource_get_by_name_and_stack

This loads resource and resource data in a single query, which means
one less sql query per stack resource in a call to describe_stack_resource.

Change-Id: Ic2e1ab68cf651f290be75206fd5c0c841de4ef82
Related-Bug: #1306743
Support proxying Heat API by using x-forwarded-for header

Adding 'X-Forwarded-For' header support to enable  Heat API
proxying

Implements: blueprint proxying-heat-api
Change-Id: I36a0d3dd3f672a485c4a9c0cd541b705033e9025