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
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
Remove nova-volume scheduling support

Continuation of I0b540e54dbabd26901a7530035a38583bb521fda

* delete scheduler.simple
* modify scheduler.multi instead of delete to continue supporting
  I753e87fc8979fd0b62529974f00cf11fa55b3d63
* update scheduler.multi docstring
* scheduler.rpcapi bumped to 2.3
* change default scheduler to scheduler.filter_scheduler

DocImpact

part of bp delete-nova-volume

Change-Id: Ie9d9b46742b2d92cd1e9ffe982ef658907a1d411
Improve EC2 describe_security_groups performance

The current implementation of EC2 describe_security_groups makes one
query per grantee group rule in _format_security_group. This will
dramatically slow down response time if users make strong use of
grantee group rules.

This patch uses just one DB query to get security groups with joined
grantee_group rules to improve the performance.

Fixes bug 1073024.

Change-Id: I34f3253bfef0eabfea39819de03a274dd6f6aaa8
Add xenapi host_maintenance_mode() test

This bit of code is currently untested (except for the most
basic stubbed-out case).

Change-Id: I7193152480ed678c89be7b7dda5edf034f5dad2e
Add some hooks for managers when service starts

Adds pre_start_hook() and post_start_hook() and fixes a couple of hard
coded binary name checks in service.py

Change-Id: I062790a88ed7f15a6f28961d6ddc1f230e19e0cb
Introduce VirtAPI to nova/virt

This patch introduces a VirtAPI class which will house
callbacks provided by the manager to the virt drivers, allowing
things such as direct database accesses to be pulled out of
the virt drivers and delegated to another service.

As a first step, this introduces an instance_update() method
and makes all the virt drivers use it instead of direct calls
to db.instance_update.*().

Change-Id: I2e40831f5cfb20a03b304097d84d592aab035ef1
Eliminates simultaneous schedule race.

Keeps host state in memory so multiple schedule attempts use the
up-to-date values that may have been modified by another greenthread.

Fixes bug 1073956

Change-Id: I69fdd9b46bde6b7408c501c42a6ef3b6dd92bbc2
Bump the base rpc version of the network api.

In d96102b we bumped the RPC version of the migrate_instance_*
calls in the network rpcapi. We did not however bump the associated
RPC version in the network manager and as such resizes are now
broken.

This commit simply bumps the RPC version of the network
manager based on the previous change.

Fixes LP Bug #1074072.

Change-Id: I4b6d6bdbcb7bb68872deee4f54b1c0636012c2cf
Merge "Remove nova-volume scheduling support"
Fix Quantum v2 API method signatures

Commit d96102b6 made a change to network.api.API but rather than making
the corresponding change to network.quantumv2.api.API it appears that
it was changed to match the network manager signature instead.

Fix the quantum signatures to match the stock network API signatures.

Change-Id: I97e16f29473f3f2e3f9c53b1e2ef10e499cef29a
Merge "Bump the base rpc version of the network api."
Merge "Improve EC2 describe_security_groups performance"
Tiny resource tracker cleanup

We're going to the bother of initializing an is_deleted_instance boolean
and then not using it everywhere we can.

Change-Id: I78c037491de336999df0f7a645a6fbab5b26d88c
move python-cinderclient to pip-requires

python-cinderclient is now actually a requirement, move
this from test-requires to pip-requires to reflect that.

Fixes bug #1074085

Change-Id: Iea6c58faab2462d137049d690d58d951bd4e2c9e
sync deprecated log method from openstack-common

the nova common deprecated util is now part of openstack-common
log class as a deprecate method. Sync openstack-common and remove
nova common util. All the deprecated pieces from folsom appear
to have already been removed, so no additional code changes needed
for this.

Change-Id: I9cbd6a67c30567cd7002e8e7fec93cfc209787fc
Merge "Introduce VirtAPI to nova/virt"
Remove db.instance_get* from nova/virt

This adds two methods to the VirtAPI for instance_get_*
operations, removing direct calls of those from the
drivers.

Change-Id: I0be42f73fb71a61bf6c46708d5879f7f8ade294d
Use elevated context in disassociate_floating_ip

The call to service_get_by_host_and_topic would raise AdminRequired
in the case that a non-admin tried to disassociate a floating ip
from their instance and multi_host was on. Using an elevated
context for the db lookup enables the host lookup to happend and
allows a user to disassociate their floating ips.

Fixes bug 1074437

Change-Id: I3d47b5a48eae21ea913120bd00728a0b8132da81
Fix no attribute 'STD_OUT_HANDLE' on windows

rename STD_OUT_HANDLE to STD_OUTPUT_HANDLE

Fixes LP #1033528

Change-Id: I75830dc4d6017076647e040d4485f99ee68333ff