refactor: extract method vm_ref_or_raise

Related to bp xenapi-volume-drivers

Imporve the code by extract method, and testing.

Change-Id: I8caca173266890bd99a360671e7af86759b89201
Force earlier version of sqlalchemy

Set the version of sqlalchemy to be earlier than the 0.8 beta as it
is incompatible with the latest available sqlalchemy-migrate and as
a result run_tests.sh does not run any tests.

Change-Id: I9c5515b76d35e4999f81d71e82f818685efe54ea
Merge "Fix VM deletion from down compute node"
Remove redundant code from PowerVM driver

This patch removes the dead instance cleanup from the
init_host() method in the PowerVM driver. Not only do
I think that it's redundant with the rest of init_host()
in compute_manager(), it's also examining the instance
task_state, which I think is a layering violation.

Tangentially related to bp/no-db-compute

Change-Id: Ie7eb4c07caa162f32021ccdbed51db950d30e2c7
Merge "refactor: extract method vm_ref_or_raise"
Make session.py reusable

This patch get_engine() into a creation part (create_session())
and a singletonization part (get_session()). create_session() can
be used from code that connects to a DB other than nova-DB.

Change-Id: Ia4ee4336871f22cfcdb67a0417fcfb76d78b6fa3
Merge "Remove nose detailed error reporting."
Add call to reset quota usage

There are certain circumstances where we may need to indicate an
uncertainty in a user's current usage of a given resource, thus
forcing a recount of those resources currently in use.  This adds
a QUOTAS.usage_reset() call which can be used to do this.  It
works by resetting the current usage to -1, which will force the
usage record to be refreshed the next time that user reserves
those resources.

Change-Id: I4a40c8edcc78ed9a7d18a293d4d7d6418b04b7f2
Merge "Clean up quantumv2.get_client"
Add scheduler retries for prep_resize operations.

Retry operations are subject to race conditions for compute resources.
prep_resize can race for resources on the destination host and
revert_resize can race for resources on the original source host.
This type of problem is handled for new instance build requests
by the resource tracker in compute.

As a first step to extending the resource tracker to cover resizes,
this patch adds scheduler retries around the prep_resize operation.

bug 1065267

Change-Id: I1b32c0a282772d9580e322b50990932016058329
Add rxtx_factor to network migration logic

Currently, when an instance is migrated from one host to another, the
only action the network API is able to take is moving floating IP
addresses.  We also need to be able to update the rxtx_factor value
to update QoS settings.  This change makes sure that the network APIs
will be passed the rxtx_factor value during a migration.

Change-Id: If4e1e96b84ee082c2d277c3d91da7df0325fc1ff
Merge "fetch_images() method no more needed"
Merge "Clean up xenapi VM records on failed disk attaches"
make QuantumV2 support requested nic ordering

fixes bug 1064524

The QuantumV2 did not honor nic ordering, so nics were attached in
Quantum's db natural order.  This patch sorts the networks honor requested nic
ordering when Nova calls the V2Quantum API.  Unit tests have been updated to
confirm ordering is honored.

Change-Id: I44a6a4736c78e86e83b6e682e63f93a5b47652da
Fixes hypervisor based image filtering on Hyper-V

Fixes Bug #1073547

Nova scheduler's ImagePropertiesFilter based filtering requires the
"supported_instances" stat returned by the driver's get_host_stats method.
This fix implements the get_host_stats method, providing also some
refactoring in the process by adding a HostOps class.

Change-Id: Ia6e73eb3e8ff0be028854fe4fd6d8e305fa1d504
Merge "Add call to reset quota usage"
Merge "Add scheduler retries for prep_resize operations."
Merge "Use env to set environ when starting dnsmasq"
Merge "Remove redundant code from PowerVM driver"
Merge "Add rxtx_factor to network migration logic"