Remove unused 'get_open_port' method from libvirt utils

As of the following commit:

  commit 71410724cd1516608ee58c37077bf9080da38de2
  Author: Thierry Carrez <thierry@openstack.org>
  Date:   Tue Feb 7 16:37:34 2012 +0100

    Remove ajaxterm from Nova

The 'get_open_port' method in the libvirt utils.py module
is no longer used. Thus is can be deleted

Change-Id: I837d07f82d55c54b4abd82d9bb20498a1f489f84
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Get hypervisor uptime.

Adds a call to retrieve the current uptime on a specific hypervisor.
This version of the patch only adds the XenAPI variant; other virt
drivers will raise a NotImplementedError until they implement the
get_host_uptime() method.

Change-Id: Ie259589757a460fcd91a49a8dd8099e4d91524e7
Make metadata content match the requested version of the metadata API.

Currently the same metadata is returned no matter what metadata
version is requested. Metadata is currently implemented to version
2009-04-04 (apart from existing TODOs) as defined here:
http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/instancedata-data-categories.html

This change adds version checking conditionals throughout
get_ec2_metadata and only includes the metadata if the requested version
should contain it.

When there is a difference between Amazon API implementation and documentation
I've gone with replicating the implementation. So far differences include:
- undocumented hostname introduced in 1.0, deprecated in favour of
  local-hostname
- kernel-id and ramdisk-id seem have to been implemented in 2007-12-15,
  not 2008-02-01 as documented

get_ec2_metadata has also been reordered so that data is added oldest to
newest by API version. In a future change I may attempt to add
unimplemented API versions (2011-01-01, 2012-06-01).

Change-Id: Ibf6e6e3b9807f29dccd31006515df550bf9bf57b
Add compatibility for CPU model config with libvirt < 0.9.10

Libvirt versions prior to 0.9.10 do not support the simpler
'mode' attribute for choosing CPU model. So with such libvirt
releases we must explicitly construct the guest CPU model
from the host capabilities info when mode=host-model. We
can not support mode=host-passthrough at all with these
earlier libvirt versions

This change can be reverted in the future, if the value of
the MIN_LIBVIRT_VERSION constant is increased to 0.9.10
or later

Fixes: bug #1003373
Implements: blueprint libvirt-xml-cpu-model
Change-Id: I3e55ffccf38be18454f810efeb5c201aab94ddb0
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Pass vdi_ref to fake.create_vbd() not a string

This would not cause a problem since vdi_ref wasn't used internally in
the fake xenapi module. At least not yet...

Change-Id: I2fe094b9c3a7d478fe20149a368af132f3258bda
Make possible to store snapshots not in /tmp directory

Add option libvirt_snapshots_directory which specifies path
where snapshots will be stored before libvirt driver uploads
them to the image service.

VM disk snapshot can be quite large,
so keeping them in /tmp is not desirable. Fedora 18 will move /tmp
to tmpfs in RAM, so snapshot functionality will become unusable with
current nova behavior.

Default path for snapshots directory is set to $instances_path/snapshots
in this patch. In case, when shared filesystem is used to hold instances,
option value can be adjusted to improve performance.

Change-Id: I9458a2a26a619a01fa1ddb6955c0220ca747e64d
Drop xenapi session.get_imported_xenapi()

Historically it was used to allow the xenapi fake module to be inserted
in place of the real XenAPI module. However, it was used inconsistently
and is unnecessary now that the session carries that information as well.

Remove it by using the session.XenAPI attribute consistently, and then
removing the stubs and ensuring that the fake module gets inserted
directly into sys.modules.

Change-Id: Id058e19eb7d932abf7b07a1e4324637a8d4b2ea6
Fix some hacking violations in the quantum tests.

This patch fixes some import sorting and HACKING violations
in the quantum tests.

Quantum client raises Exception which is discouraged by HACKING.
To avoid some of the HACKING violations we set a constant equal to
Exception and use it for the assertions in the tests.  This avoids
the HACKING violations until we can make quantum client throw a
custom exception class instead.

Change-Id: Ie52d0049dda2d18ad06c5137ca8c316c5531b56a
Assign service_catalog in NovaKeystoneContext.

Updates NovaKeystoneContext so that the service_catalog variable is
assigned regardless of whether X_SERVICE_CATALOG is set.

Fixes LP Bug #1020779
Change-Id: I3ab15fa53488f2f352718fd230d8ec5e3a38cf56
Distinguish over-quota for volume size and number.

Fixes LP 1020634

Ensure that exceeding the allowed number of volumes is not
mis-represented in log messages and exception handling as
excessive space usage.

Change-Id: I71ec995c77bc447bfc9221084b057bd8d69a4513
Ensure system metadata is sent on new image creation.

System metadata is useful for billing and notification purposes.
Sadly, this data was getting lost on new instances created from
snapshots of old instances.

This patch ensures the system metadata of the old instance is
stored in the snapshot for use with creating new instances.

Additionally, it strips the "image_" prefix from any system
metadata keys (as required).

Change-Id: I9fff55c0e9f106afcded1865c7a47bc96ba507a7
Don't catch & ignore exceptions when setting up LXC container filesystems

The 'setup_container' method in nova/disk/api.py may well raise an
exception if something goes wrong when setting up the LXC container's
root filesystem. Currently it just catches & logs any exception.
The caller thus always thinks everything worked & goes onto boot
the container despite there being no root filesystem available
for it.

The fix is to simply remove the bogus exception catching completely

Change-Id: I2691713f11cced1561f347819875f490b8aaafef
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Finish AUTHORS transition.

The code to generate the authors file from the git changelog has been in the
tree and running for a few weeks now. Somehow the removal of the authors
test and and the MANIFEST.in file were wrong though. This should clean that
up.

Fixes bug 920757.

Change-Id: I66c388c1c81804f8dabc52b5ee25c7f394921e11
Merge "Remove unused 'get_open_port' method from libvirt utils"
Merge "Assign service_catalog in NovaKeystoneContext."
Merge "Add compatibility for CPU model config with libvirt < 0.9.10"
Merge "Ensure system metadata is sent on new image creation."
Remove unnecessary setUp() method in xenapi driver tests

It creates a fake instance but then never uses it.

Change-Id: Ic98dfb0f2eb31cc0da767743dd97463deed42ca4
Remove unnecessary target_host flag in xenapi driver tests

This appears to be the result of some copy/paste of code. Setting
target_host is unnecessary for the tests and just adds clutter.

Change-Id: Iaf2abbd51af541311a2e2a4b178d7cdc4f00e116
Remove auth-related nova-manage commands

Drop support for management of deprecated auth by deleting
the following nova-manage commands:
* role *
* export *
* project/account * (except scrub and quota)
* shell export
* user *

Additionally, delete relevant documentation and tests.

Related to bp remove-deprecated-auth.

Change-Id: Iad9787f696cb55d4673d68fc60851c7f5bd25805