cleanup power state (partially implements bp task-management)

Removed duplicate and invalid state in power_state:
FAILED, SHUTOFF, BLOCKED
This is the first step in cleaning up nova state machine
and do better task management (bp/task-management)

http://wiki.openstack.org/VMState

Change-Id: I586b9058fada5efd468870fb187590fc0e37aa8f
Eliminate a race condition on instance deletes.

- Add constraint and equality conditions to nova.db[.sqlalchemy].api
- Use host constraints to ensure the compute api doesn't simply delete
  an instance from the database that a compute manager has already
  started to run.

This race condition is associated with bug #998117

Change-Id: Id74192d3e66bea073327342f57ce0f26987efd2d
convert virt drivers to fully dynamic loading

Progress on bp:virt-driver-cleanup

This series of patches converts the virt drivers to loading via
importutils making it possible to add a virt driver without changing
core code. It deprecates the use of connection_type in favor of a
full driver name in compute_driver.

Based on email thread with Vish and Jay Pipes on approaches to do
this.

Change-Id: I48366ec7efc7b095859988e5e6ac5a853b98b8a7
XenAPI: Don't hardcode userdevice for VBDs

Cleanup and refactor the way VBDs are allocated so it's clearer what
userdevice each VDI is allocated to. Also, use a dict of VDIs instead
of a list since it's nonsensical to have multiple VDIs of any type
and simplifies the code somewhat.

Change-Id: I46d6215dbd90822970a874af66f22c9a34529a40
Start removing unnecessary classes from XenAPI driver

The XenAPI driver has the concept of helper classes. All methods
have been classmethods and the classes themselves are never
instantiated. As a result, they only add an extra namespace
lookup and provide no value.

The first step is to move some functions from HelperBase to the
session class where it is better suited.

Change-Id: I13d6d49509052d35339a0ef132647bd61179cdd8
Remove vm_utils.VMHelper class

The XenAPI driver has the concept of helper classes. All methods
have been classmethods and the classes themselves are never
instantiated. As a result, they only add an extra namespace
lookup and provide no value.

Change-Id: If8a20501c9a9353359234441580552e41471722b
Remove volume_util.VolumeHelper class

The XenAPI driver has the concept of helper classes. All methods
have been classmethods and the classes themselves are never
instantiated. As a result, they only add an extra namespace
lookup and provide no value.

Change-Id: I26d1adfd378adc0728388185ba81fc4c71a41bdc
Remove network_util.NetworkHelper class

The XenAPI driver has the concept of helper classes. All methods
have been classmethods and the classes themselves are never
instantiated. As a result, they only add an extra namespace
lookup and provide no value.

Change-Id: Ief7d51013d8f313ca8c78cb157599858b156ac3f
Finish removing xenapi.HelperBase class

The XenAPI driver has the concept of helper classes. All methods
have been classmethods and the classes themselves are never
instantiated. As a result, they only add an extra namespace
lookup and provide no value.

This is the last patch in this series

Change-Id: I314dfa6555d38be9b0988270b3367c4ae86b19bb
Fix libvirt rescue to work with whole disk images

 * fixes bug 1007266
 * passes rescue image data to get_config so it only adds
   the kernel and ramdisk if necessary
 * adds tests to make sure that the kernel and ramdisk
   only appear if they are needed

Change-Id: I32e0369a066ce2b6189b4a015b30ffd8b6d3ec66
Implements resume_state_on_host_boot for libvirt.

Adds a new virt driver function to help resume guest states
on host boot. This fixes a couple issue with using a reboot
(like we did previously):

 * Using reboot would clear some task states (VERIFY_RESIZE for example)
 * Provides a mechanism for hypervisor specific guest restarts.
   Reboot would not have worked for XenServer for example...
 * Updates libvirt to use a hard reboot (instead of soft)

Fixes LP Bug #985162.

Change-Id: Iaf5aad75ec9b91f44710a18ddaf3a93378573a62
blueprint <multi-process-api-service>

Add multiprocess support for API serivces (EC2/OSAPI_Compute/OSAPI_Volume/Metadata).

2012-06-1 v7:
    * Add unittest to cover worker recovery, service termination functionality
    in wsgi.py, fix python 2.6 compatibility issue.
    * Modify generate_uid() to introduce per-process seeds in utils.py to avoid
    collisions.
    * Add worker session to nova.conf.sample.
2012-05-21 v6:
    * Fix 'test_wsgi' unittest error.
2012-04-28 v5:
    * Add SIGINT handler and fix child-parent race condition when Ctrl+C is
    pressed.
2012-03-31 v4:
    * Fixed typo, removed debug code.
2012-03-30 v3:
    * Fixed localization/pep8 error in unittest, add metadata test.
    * nova/wsgi.py:Server: use the greenthread pool created for each process.
    * nova/service.py: remove debug code
2012-03-27 v2:
    * Fixed unittest error.
    * nova/wsgi.py:Server: Use self._logger to do logging in multiprocess mode.
    * nova/wsgi.py:Server: Move self._pool creation into proper place.
    * code style fix.
2012-03-25 v1:
    * Modification to nova/service.py and nova/wsgi.py in order to support
    multiprocess (a.k.a. workers) for various API services.  If multiprocess
    mode is enabled, (i.e. flags 'APINAME_workers' set to positive numbers),
    corresponding API service will run in target number of process(es). There
    is also a master_worker process spawned for managing all workers (handling
    signal/termination).
    * Add unittest for multiprocess API service, also alter testing/runner.py
    to adopt new unittest.

Change-Id: Ia045e595543ddfd192894b2a05801cc4b7ca90cb
Add remove_volume_connection to the compute rpcapi.

Part of bug 1006467.

Add the remove_volume_connection method to the compute rpcapi.  This is
used by the compute manager.

Change-Id: I307d85782baa371a16c80bd9ecabf449a60a0876
Add get_instance_disk_info to the compute rpcapi.

Part of bug 1006467.

This patch adds get_instance_disk_info to the compute rpcapi, which is
used by the scheduler.

Change-Id: Ibb4a86d92ef402a3cc993212dfb8ce073c1c542d
Add shared_storage_test methods to compute rpcapi.

Part of bug 1006467.

This patch adds 3 methods used to check if shared storage works between
two compute hosts to the compute rpcapi.  These methods are used by the
scheduler.

This also cuts down on some duplicated code in test_scheduler.

Change-Id: If0bf7f7fdd2beb0e5280ae52daf049372f8bc9e2
Add a comment to rpc.queue_get_for().

Part of blueprint common-rpc.

Add a comment to the rpc.queue_get_for() function that notes that this
is simply a naming convention and is dependent on how queues are set up
on the consumer side.

Change-Id: Ifa7d648e9b33ad2416236dc6966527c257baaf88
Add missing import to quantum manager.

This patch adds a missing import of rpc to the quantum manager.  rpc
usage was added in d901b44fea897a038ce9a8afa32751ab79ffa210, but the
import was never there.

Change-Id: Id98a7034d190338c48d7e8c787b3d152cafe6353
defensive coding against None inside bdm
resolves bug 1007615

Change-Id: If7afa4fb030b3c53a0b80737ff792e42cc4d3101
Unused imports cleanup (folsom-2)

Fixes bug #1008023

Change-Id: Ifb8ecbb7430fdabd7b5d81ab23df66942abd9cb7
Correct use of uuid in _get_instance_volume_bdm.

Fixes bug 1007267.

Change-Id: Icc3cfbef7beabebdaba88a6f81579ae784771bd2