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
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
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
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
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
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
Fix signing_dir option for auth_token middleware.

The keystone auth_token middleware expects an option named
'signing_dir'.  The sample api-paste.ini file for nova defined
'signing_dirname' instead.

Fix bug 1073858.

Change-Id: Ie9a3df73a8d9d52b48d6e0bcce0aae762af929a9
Detangle soft delete and power off

Soft deletes are implemented by using the power_off compute method.
Unfortunately, this limits what a hypervisor driver can do to the
minimum expected from powering off an instance.

Change-Id: I577a58473885dcc8a586a0829752e8397424bc02
Remove unnecessary db call from xenapi/vmops

There are two db.instance_type_get() calls in xenapi
that don't need to be there. By fetching the info out of
the instance['instance_type'] field, we can avoid the lookup
(and adding interfaces to support this in VirtAPI).

Note that the tests require a little extra fakeage to
replicate what is happening in the real db driver.

Change-Id: I727c98fe18ca28f1db62ece2abfd50b4e13852ba
Merge "Remove db.instance_get* from nova/virt"
Merge "Fix signing_dir option for auth_token middleware."
Merge "Fix no attribute 'STD_OUT_HANDLE' on windows"
Merge "Use elevated context in disassociate_floating_ip"
Merge "Fix Quantum v2 API method signatures"
Merge "sync deprecated log method from openstack-common"
Merge "Remove unnecessary db call from xenapi/vmops"
Merge "Add some hooks for managers when service starts"
Fix unused variables and wrong indent in test_compute

Change-Id: I83a489b6a6797f60d53cc369315035d7d96afa81