Ensure live-migrate reverts if server not running

When the check to ensure a VM is running before attempting the
live migrate fails, it raises InstanceNotRunning. It should really be
treated in the same way as MigrationPreCheckError.

Along with fixing this bug, I have ensured the expected exceptions in
migrate_server are in sync with the except clause in _live_migrate.

This goes through to the API, ensuring the errors are not treated as
internal server errors, but are given a slightly more appropriate error
return value.

Currently the API returns 400 for all these kinds of errors. While other
error codes may be more appropriate, this change is concentrating purely
on ensuring we treat all the exceptions in the same way.

Change-Id: Iafe5026ef5a095d76e9864b489571e7bcfeb55f0
Closes-Bug: #1312132
versions API: ignore request with a body

Update the OS API versions controller so it ignores requests
with a body. Previously an incoming (unauthenticated)
request to the versions API would log a TypeError trace
in the nova-api.log file with the following message:

TypeError: index() got an unexpected keyword argument 'body'

Change-Id: Icc3ccfc537b13627b8d5ba43ae3ba91e34e08c9e
Closes-bug: #1306727
Fix for multiple misspelled words

In Nova code, few misspelled words have been found.
The misspellings python library has been used to scan
all nova code and find misspelled words.
This commit fixes all misspelled words found with this library.

Change-Id: I5919dddbbe812d8d32ecd8b249c1312249cd2a66
Closes-Bug: 1323730
Add unit test trap for object change detection

This adds a test that compares each object to a known hash that
covers the list of remotable method signatures and the field
definitions. Storing this in the code helps us assert that our object
definitions have not changed without a version bump. If someone
adds or changes a field or method to an object, this test will
fail, reminding them to bump the version and update the hash.

This adds a 'remotable' attribute to the methods decorated as such
so that we can detect them separately from local methods which
do not need a version bump.

Change-Id: I3e8bd387e36cec406baf4c6933baca9e1663d122
Change conductor to cast to build_and_run_instance

With build_and_run_instance taking over for run_instance in the compute
manager, this switches over to calling it.  With this change the build
process will not cast back to the scheduler on a build retry.

This is the final part of a series of patches to build up the
build_and_run_instance method.

bp remove-cast-to-schedule-run-instance
Change-Id: Iefab71047996b7cc08107794d5bc628c11680a70
Deprecate run_instance and remove unnecessary code

This begins a deprecation path for the compute manager run_instance
code.

For now the scheduler run_instance rpc method is being removed as it is
unused.

In the K cycle the scheduler schedule_run_instance methods can be
removed which means that the run_instance compute rpc method can be
removed.

In the L cycle the run_instance compute method can be removed.

This also removes cells schedule_run_instance methods which have been
unused since Havana.

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

Change-Id: I284ac124fe2ec952db0feab61206eda2a20e40c8
Use objects through the run_instance() path

This removes the use of dict-based instances for the run_instance
path when called from conductor to compute manager.

Related to blueprint compute-manager-objects-juno

Change-Id: I8a206f63cab1e4f939d2c97c258312a8fa540aff
Refactor test_rescue_unrescue into compute api/manager unit tests

As part of converting the rescue/unrescue compute API flows to using
objects, i.e. dot notation for accessing attributes on the instance
object and updating the database via instance.save() rather than
compute_api.update, we want to move some of the integration-style tests
found in test_compute.py to test_compute_api.py and test_compute_mgr.py.

This is to help with the conversion so we don't have to use exotic stubs
in the cells API flows to make integration tests work.

This change is mainly concerned with moving test_rescue_unrescue out of
test_compute.py and into the api/manager specific test modules and then
later changes will build on top of the new tests.

Part of blueprint compute-manager-objects-juno

Change-Id: I2a9b1c6b5a1f41272e26c20de134a2a8b71c88f3
Treat instance objects as objects in rescue API flow

The compute API and manager are getting instance objects now but
treating them like primitive dicts still in several places, so this
cleans that up.

Also adds the instance to the warning log message in _get_rescue_image
since (a) I'm already in there and (b) it adds context for the message,
which is useful.

Cleans up the related tests so they are using objects as well to verify
the changes to compute api/manager are correct.

Part of blueprint compute-manager-objects-juno

Change-Id: Ibe4473fc08fd68676aaa1e1c9ba69161fc5f527e
Treat instance objects as objects in unrescue API flow

The compute API and manager are getting instance objects now but
treating them like primitive dicts still in several places, so this
cleans that up.

Cleans up the related tests so they are using objects as well to verify
the changes to compute api/manager are correct.

Part of blueprint compute-manager-objects-juno

Change-Id: I81fa858a821a2137fce5970905b9b1c71c95304b
xenapi: tidy up volumeops tests

Remove the old attach volume tests, as they are no longer required, and
tidy up the dead code left behind.

Change-Id: Iadd3741ddf87974dc79d2fe5986083b082f7e314
Merge "versions API: ignore request with a body"
Merge "Change conductor to cast to build_and_run_instance"
Updated from global requirements

Change-Id: Icdb6e17edab010bef272dd0bf5b20973ba759282
Merge "Add unit test trap for object change detection"
Merge "Ensure live-migrate reverts if server not running"
String-convert IPAddr objects for FixedIP.attach()

This fixes a couple places where we pass a (non-serializeable)
IPAddr object to the FixedIP.attach() method, which blows up.
We probably need a more generic solution to this problem, as it
keeps coming up. However, for the moment, this is less problematic
than the patch reverted just before this.

Change-Id: I716c558a3535b3ed5c9b10f5788a4463a3daa3d3
Fix docstring typo in need_legacy_block_device_info

Change-Id: I9aaec5f73f3001c0926aba2fba4165f3a66319f1
Merge "Refactor test_rescue_unrescue into compute api/manager unit tests"
Merge "Treat instance objects as objects in rescue API flow"