Prefer instance in reboot_instance.

Now that we're passed through an instance, or something which is
immediately turned into an instance, we should prefer using the full
instance inside compute methods. This is especially useful for log
messages, as it allows users to format the messages more than they
can if only the UUID is passed.

Change-Id: I29370f33a63817f3e45d453499bd46131b947d7e
Instance cleanups from detach_volumes.

We can just use members of the instance dictionary without turning
them into local variables, as we don't need to populate instance_uuid
manually, as that is done by the @checks_instance_lock decorator.

Change-Id: I2046d5688c2f5122624dc338680b7ddd850ed330
Xen: VHD sequence validation should handle swap.

The VHD sequence validation code was erroneously counting `swap.vhd`,
which caused it to raise an exception when a corresponding numbered VHD
was not found.

The fix is to simply ignore the `swap.vhd` file.

Other unknown VHDs will generate an exception, but from a
sanity-checking perspective, this is a Good Thing(tm).

Fixes bug 1030939

Change-Id: Ic82ae27a4af7ea8f7669fd006aea1a310b691218
Tidy up nova.image.glance

* Add comment explaining relevance of _is_image_available
* Drop superfluous log statements
* Drop GlanceImageService.delete_all as it has never been implemented
* Drop the 'features' kwarg for GlanceImageService.update
* Code simplification

Change-Id: Ie538dd93dec729fb060bbcddfbddcba6cf303e52
Avoid associating floating IP with two instances.

Addresses LP 1029911.

Associating an already-associated floating IP with another instance
results in the floating IP being first disassociated from the original
instance and then associated with the second instance.

However when this transfer of the floating IP to the second instance
occurs, the network info held in the database instance info cache was
previously only updated for the second instance (via the
@nova.network.api.refresh_cache decorator).

As a result, the floating IP was initially reported as being associated
with *both* instances. This misreporting is temporary - eventually the
periodic heal_instance_info_cache task will roll around and purge the
inaccurante network info for the original instance. However depending
on the frequency configured for this task and the size of the instance
population, it could take a while for the refresh to occur.

This issue is addressed by immediately purging the obsolute network info
when the reassignment occurs.

Change-Id: Ibfb04997ff4a983d144d81350857cb07475aff54
Use event.listen() instead of deprecated listeners kwarg

Fixes bug 1031405

The listeners kwarg is deprecated in SQLAlchemy 0.7.0. Since 0.7.3 is
the minimum required version of SQLAlchemy, use the new event.listen()
API instead.

Change-Id: I3d2bd2e65dbc6787d1c9b69ffd0bcff85c157869
Merge "Xen: VHD sequence validation should handle swap."
Merge "Avoid associating floating IP with two instances."
Merge "Prefer instance in reboot_instance."
Merge "Use event.listen() instead of deprecated listeners kwarg"
Merge "Instance cleanups from detach_volumes."
Compute: Error out instance on rebuild and resize.

If a rebuild or a resize fails, then we should error out the instance.
This code takes an idiom we already use in the compute manager and adds
it to the rebuild and resize code.

Change-Id: Ia90c038eb4677e109d58e9b79bb8a05490689c9f
Send a full instance in unrescue_instance.

Change the unrescue_instance method of the compute
rpc API to take a full instance over rpc instead of just
the instance UUID.  This cuts down on database access needed
by nova-compute.

Part of blueprint no-db-messaging.

Change-Id: I9a693b347ce583aa350f4c10531b53e0f9813577
Send a full instance in change_instance_metadata.

Change the change_instance_metadata method of the compute
rpc API to take a full instance over rpc instead of just
the instance UUID.  This cuts down on database access needed
by nova-compute.

These methods were moved in rpcapi.py and test_rpcapi.py but only because
the rest of the file was in alphabetical order.  The move puts it in the
right place to maintain that order.

Part of blueprint no-db-messaging.

Change-Id: I7dd2fb7480010893f66c753b3d31a4556009efe0
Avoid recursion from @refresh_cache

Previously the decorator current called out indirectly to
nova.api.network.api.API.get_instance_nw_info(), which is also
decoratored by @refresh_cache.

Change-Id: I8b71e2f6c85d007cde0da32890168c922102a7d8
Update targets information when creating target.

tgt-admin needs to use --execute --update to tell
tgtd to re-read its configuration files when target
is created.

(LP: #1031509)

Change-Id: I71fe4d90a8cc9bcf7a4817aefd6de52e216102a4
Signed-off-by: Chuck Short <chuck.short@canonical.com>
Merge "Send a full instance in unrescue_instance."
Merge "Send a full instance in change_instance_metadata."
Merge "Update targets information when creating target."
Merge "Tidy up nova.image.glance"