Unimplemented pause should not change vm state on PowerVM

The instance of PowerVM does not support pause, but
after pause the instance, the state change to PAUSED,
it's unreasonable.

Change-Id: I4fb184388c37ea8708cdacc173dc1b2dbd4d1597
Fixes: bug #1202082
Handle instance being deleted while in filter scheduler

Adds handling of InstanceNotFound when trying to update the
scheduled_at time of an instance.

Users can delete an instance at any time (and many test
cases delete very quickly), so this should be a warning
not an error

Fixes bug 1191126

Change-Id: I72b296668f60b1de71ff8c6d7bbb749023d89f12
Fix aggregate_get_by_host host filtering

aggregate_get_by_host never actually joins the _hosts relationship,
so aggregates with non-matching hosts are still included in the output.

This change adds the join and improves the tests to cover the bug.

Fixes bug 1201277.

Change-Id: I87ebfe3de193b9ae47e3a2c8350a49d9cc863fb0
Fix filtering aggregate metadata by key

Filtering by metadata key has no effect in the following two functions:

    aggregate_metadata_get_by_host
    aggregate_host_get_by_metadata_key

Rely on the explicit join instead of joinedload to load the _metadata
relationship in these functions (indicated by the contains_eager
option), so that filtering by key still applies when the metadata is
collected.

Fixes bug 1201283.

Change-Id: I3e44b5db8d67787bfa14f0e57d30a02a271a8833
Remove locals() from various places.

fixes bug 1171936

Remove usage of locals() for string formatting

Change-Id: Ib05538095086ddefdb486c84da506af662ec5c9b
Raise exceptions when Spice/VNC are unavailable

Bug 1192724

Both Spice and/or VNC may be enabled from the perspective of compute
configuration but their actual availability can vary based on
whether either was enabled/disabled at the time the instance was
launched. This patch raises a proper exception in this case, such
that clients (including Horizon) can either message the user or fall
back.

Change-Id: If06e726e606f4a27c8ec4617400b728ce7112e3b
Code dedup in test_libvirt_vif

- externed common assertions to methods
- externed common parts to methods:
  - description of net data
  - description of mappings data
  - creating fakelibvirt connection
  - creating libvirt configuration
  - getting node from xml

bp nova-tests-code-duplication

Change-Id: Id12e196519473cce27a998e37f33ce584f703a4f
Fix parse_transport_url when url has query string

In python < 2.7.4 the query string from an url is only parsed for the
schemes that the module knows about (not including 'qpid' and 'rabbit').
This behaviour was changed in python 2.7.4 and now it parses the query
string for all the schemes and doesn't appear any more in the path.

This change makes sure that we look for the query string in both members
(query and path).

See http://bugs.python.org/issue9374

Fixes bug #1202149

Change-Id: Ic6afbe7b431e3eb9ff28d3c9b3fa35a52efb3fb6
Send updated aggregate to compute on add/rm host

The XenAPI driver relies on getting an up-to-date version of the
aggregate during add_host_to_aggregate and remove_host_from_aggregate
This change ensures that happens.

Fixes bug 1161619
Change-Id: I764e1fc3b9ff20b6eda8f6ec00849f2164de0a49
Convert suspend/resume to use objects

Switch suspend/resume to use objects.  This also converts the compute
API tests to be unit tests.

Related to blueprint compute-api-objects

Change-Id: I256e495b214742f28d21ca9d779716f32c56f9bc
Make Instance.save() handle cells DB updates

This adds support to Instance.save() to handle updating cells with
changes to the instance.

Instance.save() needs to support expected_vm_state when saving changes.
It also needs to understand whether or not any task_state/vm_state
changes are coming from a forced-reset.  Normally we do not want to
update child cells' view of vm_state and task_state, but forced-resets
should be sent down.

Adds a new cells method for updating instances in child cells.

Related to blueprint compute-api-objects

Change-Id: I228bc3e0288ca94fd30b91eaf1bc5b77bcdc249f
Make servers::update() use Instance.save() to do the work

This makes the update() api call operate on the instance object
directly, by calling update() and save(), instead of calling into
compute_api to do the work.

This requires an extension to a previous kludge for api_samples
to make sure that the database gets updated in sync with the
values we're stubbing out for network information.

This also requires a tweak to one of the tests to return an
updated fake instance object directly from the database, instead
of just from the compute_api.

Related to blueprint compute-api-objects

Change-Id: I62b4009ef97ea47b20442a149ba172de4e343e15
Handle instance objects in conductor compute_stop

The compute manager is sending instance objects to
compute_stop in conductor but conductor's compute_stop
RPC proxy wasn't handling objects. This patch fixes that
and also handles compatibility with older installations
using the dict-style format in the conductor compute_stop
RPC proxy.

Fixes bug 1195849

Change-Id: Ib678df424a58a0d7023ce3b2bdd5001998daf398
Merge "Fix parse_transport_url when url has query string"
Merge "Code dedup in test_libvirt_vif"
Merge "Unimplemented pause should not change vm state on PowerVM"
Merge "Fix aggregate_get_by_host host filtering"
Merge "Fix filtering aggregate metadata by key"
Merge "Raise exceptions when Spice/VNC are unavailable"
Merge "Convert suspend/resume to use objects"