Add a driver method to toggle instance booting

Add a driver method to toggle the ability to boot an instance.

The only implementation provided is for the xenapi virt driver.  Other
drivers will log a warning and treat the method as a no-op.

Implements: blueprint cleanup-running-deleted-shutdown

Change-Id: Ie448c681d653b126cb12d3a48d79ab4febde8828
objects: declare some methods as static

A lot of code is composed of static methods, but they are not declared
as is.

Change-Id: I64be630b560e331aed9d1ab9a68152da52eb0d82
Use model_query() instead of session.query in db.instance_destroy

Unify db.instance_destroy() method to use model_query() as others
methods use.

Side effect we won't try to soft delete already soft deleted instance

Change-Id: I36d5bb42b16901c260ff4276e31a6aec46ffa8a4
Fix missing format specifier in ImagePropertiesFilter log message

Commit a52259e introduced some changes to debug log messages in the
ImagePropertiesFilter but with that came a bug due to a missing format
specifier.

Closes-Bug: #1253875

Change-Id: Ic60b7ba179bd43b80c500be084a1809b6b0b32ca
Adjust the order of notification for shelve instance

When shelve instance, if CONF.shelved_offload_time == 0, then the
notification order for shelve_instance() is as following:
1) compute.instance.shelve.start
2) compute.instance.shelve_offload.start
3) compute.instance.shelve_offload.end
4) compute.instance.shelve.end

This order is not correct, as actually before shelve_offload.start,
the instance was already reached shelve.end, so we should adjust the
order of notification for shelve instance as following:
1) compute.instance.shelve.start
2) compute.instance.shelve.end
3) compute.instance.shelve_offload.start
4) compute.instance.shelve_offload.end

Change-Id: I6e075b3f29e1c3f641ab1e459e1fbe3b05869a9a
Closes-Bug: #1248802
Improved debug ability for log message of cold migration

When cold migration failed because of nova scheduler return no
valid host, conductor only log no valid host, but did not specify
which instance failed.

This patch was specifying instance in the failure log for cold
migration.

Change-Id: Ia9e42f8f253323fb35a58e0be2a24ab043204d29
Bump to sqlalchemy-migrate 0.8.2

This allows us to drop some unsightly
0.7.3 patching and also avoids potential
issues in using 0.8.1 which had a bad
release version string (it was called '0.7.3dev' by mistake).

This will require a requirements change here:

 https://review.openstack.org/56662

Change-Id: I5f80dfc07f8256716d025002fc1a1f47e58b2142
Closes-Bug: 1251700
Supplement 'os-migrateLive' in actions list

The test for actions with non existed instance missing the action
'os-migrateLive'.

Change-Id: Ia36c369d60bea9500cc5a64be7971e60cbe79377
Closes-Bug: #1255023
Fix some i18n issue in nova/compute/manager.py

Some exceptions in nova compute manager did not follow i18n coding
style, just fix them.

Change-Id: I9cc18c05419508232062c749c0f9740c5241469d
instance state will be stuck in unshelving when unshelve fails

When unshelve an instance, if this instance has been offloaded,
the conductor manager will involve re-schedule for the instance.
If re-schedule failed to find a target host for the unsleved
instance, then the instance will be stuck in unshelving state.

This patch fix the issue as this: If re-schedule failed to find a
target host for unshelve the instance, then conductor manager will
try to rollback the instance to unshelve state.

Change-Id: If49b2d2c9263b853c745ce25fe146ade51948123
Closes-Bug: #1248799
Change ConductorManager to self.db when record cold_migrate event

In conductor manager, when cold migrate an instance, conductor
manager will record event of cold_migrate.

When record this event, conductor manager pass ConductorManager but
not self.db as parameter for compute_utils.EventReporter(), as we
can access the db directly from conductor manager so going through
ConductorManager as a proxy is unnecessary.

Change-Id: Ic52228c2550294c2df37d10d36637e4d0e3a1a30
Remove duplicate BuildAbortException block

Somehow, most likely due to a bad rebase, there were two
BuildAbortException blocks in the same section.  This removes one.

bp remove-cast-to-schedule-run-instance

Change-Id: I29684e222f18e6da280ed181447750525d878423
Pass Instance object to spice compute rpc api

Update the get_spice_console() method of the compute rpc api to take in
an Instance object instead of a dict.  The object_compat() decorator is
used to maintain backwards compatibility with receiving a dict.

Change-Id: I0bafe18d9c8bffcd0b72629542fbf7aedacdfbb4
Fix a tiny double quote matching in field obj model

Fix a tiny double quote matching in CIDR field type.

Change-Id: Ifa226b1fe7b2a3c337bebcc30f18cf5e401ec7b8
Merge "Use model_query() instead of session.query in db.instance_destroy"
Merge "Improved debug ability for log message of cold migration"
Merge "Adjust the order of notification for shelve instance"
Merge "Fix some i18n issue in nova/compute/manager.py"
Make object compat work with more positional args

Currently object_compat would break if there is more than one positional
argument after instance, since the instance will be passed as a keyword
argument and there will be a positional argument passed as instance,
once we get to the actual function call - a TypeError will be thrown
similar to:

    TypeError: ... got multiple values for keyword argument 'instance'

This patch makes sure that the instance (if not found in kwargs) is put
back in the args tuple.

Change-Id: I5e9085e9f1bc1502f627eb9b206376cf39d58f39
Merge "instance state will be stuck in unshelving when unshelve fails"