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
Sync v2/v3 console_output API extensions

Synchronises changes made to the v2 version of the console_output
API extension to v3 in commit c651f4928c65407cff86a9f9efc046a0f76a9519
which fixed bug  #1194032

Partially implements blueprint nova-v3-api

Change-Id: Ie28d771d25636decb7b1f17756654be56762b35f
port disk_config API into v3 part1

This changeset only copies the v2 files into the appropriate v3
directories unchanged. The copy as-is will not be loaded by either
the v2 or v3 extension loaders. The second changeset will then
make the changes required for it to work as a v3 extension.

This is being tried in order to make reviewing of extension
porting easier as gerrit will display only what is actually
changed for v3 rather than entirely new files.

Partially implements: bp v3-api-extension-versioning

Change-Id: Ia2ef4ab8cb63878d16360378c61e5182f4593200
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 IPAddress and CIDR type decorators

Use load_dialect_impl() user hook instead of calling
with_variant() on a type implementation in IPAddress
and CIDR type decorators. This makes this code work
with SQLAlchemy 0.8.x versions.

Fixes bug 1200231

Change-Id: Ib0eb582f472116bda817d3e35e26888dc116ad58
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 redundant if statements in cells.state

Removed redundant if statements since checking if cell is None twice
was not intuitive.

Change-Id: I20d7ade5acd27d23ba53ef065d0e4d24218182c2
Refresh network cache when reassigning a floating IP in Neutron

When Nova associates or disassociates a floating IP address
the network info cache is always refreshed due to the
@refresh_cache decorator

However if you (re)associate a floating IP which is already
associated with another instance on a Neutron based system then
the address is correcly disassociated first, but the cache refresh
is not trigged for the original  instance. As a result Nova will
show the same address for two instances until the periodic
clean-up kicks in some minutes later.

Fixed bug: 1173227

Change-Id: Iea81532911478026b9b2c0578a1eda7a97b09d80
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
Fix HTTP response for PortInUse during boot

If an in use port is passed as a network parameter in the request, Nova API
should raise an HTTPConflict (409) error

Fixes bug #1160887

Change-Id: I60103610f9143f1c668927fe40d10a14b39b4c25
Make compute_api.reboot() use objects

This makes the compute api's reboot() method use objects and pass
them to compute/manager.

The one place we call back from compute/manager to compute/api's
reboot() is also converted to use objects in this patch. That
almost makes bug 1196301 go away, but will require instance
actions work as well.

This also adds a new cells method for passing the object to reboot in
the child cell.

Related to blueprint compute-api-objects

Change-Id: I7845daa266687b5dc24fc2b1a98f2e5a2841e4bf
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
Check that the configuration file sample is up to date

We added this check recently to Ceilometer, and it helps a lot to keep this
file always up to date and not falling behind.

Change-Id: I5ad2c6366032a39c2e55dd11a16b9f1780ab9ed0
Merge "Make compute_api.reboot() use objects"
Merge "Sync v2/v3 console_output API extensions"