Reverse order of cinder.detach() and bdm.delete()

The user experience for detaching a volume is better if the bdm
is destroyed as soon as the driver has detached the volume instead
of waiting until after we have updated cinder.

Change-Id: I6f3de25f7737db270af4ba41d7451ae95f3950f5
Closes-Bug: #1309154
Merge "XenAPI: Tolerate multiple coalesces"
Merge "Reverse order of cinder.detach() and bdm.delete()"
Imported Translations from Transifex

Change-Id: Ida82c5bf325e21c16a99ce7dff686421af7a1784
Merge "[EC2]Correct the return status of attaching volume"
Merge "Downgrade log when attach interface can't find resources"
Enable flake8 F841 checking

This check looks to see whether a local variable
is unused. Fixed all of violators of said check.

Change-Id: I6ff349ca8d650ae7d6ebeeb116a1649b0db8f071
VCDriver - Ignore host in Maintenance mode in stats update

The VCDriver during stats update checks only for connected hosts.
However hosts which are in connected state to the Cluster can
be set to Maintenance mode.
The cluster does not boot instances to hosts which are in
maintenance mode.
Hence the VCDriver should check for hosts which are in
maintenance mode and ignore them for stats update.
VISDK API returns True for the property inMaintenanceMode for
Hosts which are in maintenance mode

Change-Id: Ieaf7530ed2d98c59c5450e8cb75e209823193d49
Closes-Bug: #1316674
Sync periodic_task from oslo-incubator

We have not updated periodic_task in over six months and we should have
commit 47c9d60657be4ad58afa3c7e3ef88885a595c4c3 in nova.

Note that this does not include the gettextutils and log dependencies
since there are not functional changes in those modules needed for the
periodic_task changes synced in *and* more importantly, the changes
to gettextutils and log require pervasive changes to nova which should
happen when nova integrates with the oslo-i18n library for
blueprint i18n--messages.

Further note that this does not include jsonutils due to some
issues introduced with a change for python 2.6 that impacts some of
the unit tests in Nova and how strings are encoded with simplejson.
The details for that issue are in bug 1314129.  The jsonutils changes
are not related to the periodic_task changes being synced in so the
dependency is not functionally required.

periodic_task:
c63fd5a Make unspecified periodic spaced tasks run on default interval
f0dd798 Remove rendundant parentheses of cfg help strings
fcf517d Update oslo log messages with translation domains
051b9f3 Refactor unnecessary arithmetic ops in periodic_task
674cdaf Refactor if logic in periodic_task
b6b82c5 Use timestamp in periodic tasks
47c9d60 Don't share periodic_task instance data in a class attr
8b2b0b7 Use hacking import_exceptions for gettextutils._
c5a1088 Typos fix in db and periodic_task module
12bcdb7 Remove vim header

Related-Bug: #1319232

Change-Id: I5534e85ae8791c7c464357f7fd57b986ff74d092
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
remove cpu feature duplications in libvirt

This patch fixes a bug in libvirt driver get_host_capabilities where
some features can be duplicated. In this patch we use the features returned
from baselineCPU as the only set of features.

Change-Id: Ib708e31e5ae14e93b384d2a8933079ca83ca8aaf
Closes-Bug: #1322702
Fix migration and instance resize update order

This commit switches the order in which migrations and instances are
updated when resizing an instance. Previously, if you set
resize_confirm_window to some small value, your resize instance could go
into error state because the periodic task was run after the migration
was updated but before the instance object was updated. This change makes it
so the instance is always updated before the migration.

The _test_finish_resize test case has also been refactored to enforce
saving the instance object before the migration object. In the event
that the instance object is saved after the migration, like the previous
implementation, the test cases will fail since the states of the
migrations will be out of sync in the _mig_save assertions.

Closes-Bug: #1321298
Change-Id: I0490fc4b4e03b36eb01a06a95ea761f4cf8df469
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
Virt: ensure that instance_exists uses objects

Ensure that the method now receives a data object as input.

Change-Id: I6b5a9c9defb61388035ef7d511ccd96998b695aa
xenapi: move StorageError into global exception.py

We have our own exception for StorageErrors, and this is causing some
interesting dependency issues, so seems best to move this exception into
the more usual place.

Change-Id: I4f1f33e95f1050874ef828af9b35b0edbf8f0176
xenapi: remove calls to call_xenapi in volumeops

As part of the move to remove calls to call_xenapi, this removes calls
in volumeops. This makes the later refactoring and test coverage patches
much easier to write.

Change-Id: I384d7d85382551d32122d475768f015e8dfd8769
xenapi: refactor volumeops attach

Refactor the attach code, so its more readable.

At the same time, add some new unit tests to better cover the volume
attach code.

In a later patch we will remove the older mox tests, and dead code that
is now only left in volumeops to keep those old tests running.

Change-Id: Ic50dba5588bb968eca3ac2bf94c3eb719fa2cf6b
Fix EC2 not found errors for volumes and snapshots.

According to AWS docs
(http://docs.aws.amazon.com/AWSEC2/latest/APIReference/
api-error-codes.html)

Change-Id: I43af230b975263bb2a14e0cc0bd8718f55bd8a55
Closes-Bug: #1323813