Fix wrong regex in cleanup_file_locks.

The sentinel filename actually has form hostname-threadid.pid,
not hostname.threadid-pid.
Launchpad bug 1018586.
Change-Id: I09c01e0e63ee704b1485c196dc0b396ee03b2e5c
Adds xcp disk resize support.

Implements resize image during instance creation.  Fixes bug 1016650.

Change-Id: I25f9d1030d9d014b1c9a65430bd535388b8f8943
Use compute_driver in xenapi driver help messages.

Updates the help messages in the xenapi driver to use 'compute_driver'
examples instead of 'connection_type' which is now deprecated.

Change-Id: I79b050f0b083533e60129da261326cfb7f304321
Xen: Ensure snapshot is torn down on error.

This patch solves the problem of snapshots being left around if an
exception is generated in _wait_for_vhd_coalesce.

The solution is to separate snapshot from coalesce and then to ensure
any exceptions generated after a snapshot trigger a cleanup.

Change-Id: I4c03243bc41f76d80d32934dd9506d1861951184
Return 400 in get_console_output for bad length.

Fixes bug 1027069. Prior to this fix if the length in the
request body was set to a non-integer value a error code of 500
was returned. The documentation also shows an integer in the
example request body.

The fix tests if the optional length is provided and
if it is either an "int" or "long". If not, a 400 error
is returned.

Additionally, cleaned up some error message to be more
descriptive.

Change-Id: I27a66fb1111e74665969f98e1101a9c37c665abc
Fixes console/vmrc_manager.py import error

Fixes bug #1028748

Change-Id: I1be5637f561008489fe7367052ec2ecb6b9ae59f
Allow floating IP pools to be deleted

Fixes bug #1022237

If you delete all the floating IPs associated with a floating IP, the
pool still shows up in os-floating-ip-pools extension.

Fix this by using model_query() in the DB layer so that we ignore
deleted floating IPs.

Change-Id: I30d2e716e931400ca4b798b51bb26a73a7747808
Add missing parameters to novas cinder api

* Addresses bug 1028684
* Adds metadata and other parameters to volume create and translate_view

Change-Id: I0c1def739c4a5cbcd2dbe72df6fc54b16e68b4b7
Check for exception codes in openstack API results

 * Inspect all exceptions for code, not just nova.exceptions

   Originally the fault wrapper would only inspect an exception for
   status, header and safe attributes if it was a nova.exception.

   As a result, excecptions returned from Cinder were always being incorrectly
   interpretted/categorized as ComputeFaults (500).  This results in tempest
   tests that expect exceptions such as 404 NotFound to fail.

   Now that we're checking all Exceptions the same way, there's no need
   for a specifying nova.exceptions or even doing the import.

Change-Id: If49e364063d5288c81ce1557bddc6dcec3ec457e
Define cross-driver standardized vm_mode values

Currently the XenAPI driver allows for a 'vm_mode' parameter to
be set against an instance to determine whether it is launched
a paravirt or fullvirt domain. This allows the values 'pv', 'hv'
and 'hvm'.

The libvirt driver also needs to be extended to allow a 'vm_mode'
parameter, and to facilitate deployment of heterogeneous Nova
compute farms, it is desirable to have standardization of the
VM mode values across all drivers.

To address this, the nova.compute.vm_mode module is introduced
which defines a set of constants. The constants provide four
possible vm modes:

 - vm_mode.XEN = 'xen' - for Xen 3.0 paravirt ABI
 - vm_mode.HVM = 'hvm' - for native ABI
 - vm_mode.UML = 'uml' - for User Mode Linux paravirt ABI
 - vm_mode.EXE = 'exe' - for container virt executable ABI

The existing 'pv' value from XenAPI is deprecated, because it
is ambiguous - both Xen and UML are paravirt, and other
paravirt hypervisor ABIs also exist

The existing 'hv' value is also deprecated since it duplicates
the other existing 'hvm' value.

The 'vm_mode.get_from_instance' method will extract the
vm_mode value for an instance. It normalizes the value to
all lower case, translates 'hv' and 'pv' into the new
values for back compat, and validates that the value
matches one of the defined constants

The XenAPI and libvirt drivers are then updated to use the
nova.compute.vm_mode constants instead of bare strings.
The test_xenapi.py test case is updated to set 'vm_mode'
to exercise the new codepaths. A new test_vmmode.py
case is also written to fully exercise the logic

NB, previously the libvirt driver would set 'guest.os_type'
to 'linux' to request Xen paravirt. This is a legacy value,
with libvirt preferring the string 'xen'. So although the
new code sets a different value for Xen paravirt os_type,
the functional result is unchanged.

DocImpact
blueprint hypervisor-code-consolidation
Change-Id: I23efc5dc1528b0d8472d752a8a30f55c85310b21
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Remove temporary variable

Change-Id: I53fd54bad1f08d8c1d4ebf27a5a282189c0f3c04
Merge "Check for exception codes in openstack API results"
Merge "Add missing parameters to novas cinder api"
Merge "Xen: Ensure snapshot is torn down on error."
Merge "Use compute_driver in xenapi driver help messages."
Merge "Adds xcp disk resize support."
Add missing tempfile import to libvirt driver.

import tempfile in the libvirt driver.  This is needed in
_create_shared_storage_test_file().  I saw this come up on the mailing
list:

    http://lists.openstack.org/pipermail/openstack-dev/2012-July/000192.html

Change-Id: Ib327772d61be0202b257049d8aca3d04819a48f5
Merge "Define cross-driver standardized vm_mode values"
Merge "Add missing tempfile import to libvirt driver."
Inject instance metadata into xenstore

When using Xenserver, inject instance metadata into the xenstore, for
the use of the instance.  Implements blueprint xenstore-metadata.

Change-Id: I88a59f1b783eaaaef6ba5efd8bd448aece2f869c