Retry resource create until success

On resource create, if a ResourceInFailure is raised then
repeated attempts are made to delete and recreate the resource
until success or a different error state is achieved.

Likewise, the prepare-retry deletes will be retried until
ResourceInFailure is not raised.

An exponentially increasing delay with jitter is introduced
between each create attempt, and attempts continue up to the configured
action_retry_limit or stack operation timeout.

Likewise An exponentially increasing delay with jitter is introduced
between each prepre-retry delete attempt, and delete attempts
continue up to the configured action_retry_limit or stack operation
timeout. The delete attempt count is reset to zero whenever a create
attempt has been performed.

Creates that result from an UpdateReplace will also go
through this path, so this is also helps some stack update scenarios.

This change is aimed at being part of an interim solution to making
heat resilient to transient cloud failures. Convergence is the
permanent solution however there may be benefits to the convergence
implementation from this interim effort.

Currently retry is only attempted on ResourceInFailure. Eventually
client plugins can indicate whether a given exception should lead
to a retry attempt (such as connection errors, some 500s).

Partial-Blueprint: retry-failed-api-calls
Change-Id: I07c3301349bcd24096f3cafbb6d82c43bccb93de
Restore resource_id from backup_stack

When UpdateReplace is occurred, the resource is moved to backup_stack,
and create new one. Then, resources which has dependency for updated
resource will be moved to backup_stack.

If the creation of update is interrupted by some reason(e.g. heat-engine
down), dependencies between backup_stack and exist_stack will exist.

Heat deletes backup_stack before deleting exist_stack. The dependency
still exists, so it will be failed. Thus, add behavior that restores
resource_id in the backup_stack when the stack is deleted.

Change-Id: I32cecba17ae160d4631fb2611e34b91bb921dc5e
Closes-bug: #1334514
Merge "Retry resource create until success"
replace dict.iteritems() with six.iteritems(dict)

According to https://wiki.openstack.org/wiki/Python3 dict.iteritems()
should be replaced with six.iteritems(dict).

Change-Id: I9e2881a006433c8b44a3caccebc73bae4973a041
LaunchConfiguration replace on changed Metadata

This makes AWS::AutoScaling::LaunchConfiguration raise
an UpdateReplace if its template Metadata is changed on a
stack update. Any changes to LaunchConfiguration should result
in the resource being replaced, since this is how those changes
propagate to the scaling group.

This fixes a regression which has likely existed since
update_allowed_keys was removed: I78494aba07b6badeca8e95f1875ca8e4b9b0290c

Change-Id: I3a53422ed862777dffb9cac28088fbfe8dd417fa
Closes-Bug: #1287953
Merge "LaunchConfiguration replace on changed Metadata"
Merge "Restore resource_id from backup_stack"