Properly track VBD and VDI connections in xenapi fake

The fake xenapi module correctly destroys VBDs when destroying a VM
but it won't destroy VBDs when destroying a VDI. If an exception
occurs during a spawn when running test_xenapi, then another exception
can occur which obscures the original (and likely more important)
exception. This can make troubleshooting test suite failures more
difficult.

Change-Id: I19aad7f39b0707893a04784faef90815f7b0effb
Fallback to fakelibvirt in test_libvirt.py test suite

If the native 'libvirt' module is not available on the host,
currently test_libvirt.py stubs it out to ''. While this
has sort-of worked for some test cases, others have had to
be configured to skip. As the complexity of the libvirt driver
increases, ever more tests will need to be skipped.

There is, however, the fakelibvirt.py module which provides
a dummy impl of the libvirt APIs for use in test_virt_drivers.py
With a few enhancements this fake impl is good enough to use
with test_libvirt.py too.

The constructor of libvirtError is changed to accept the
'msg' as first arg to match the regular libvirt module.
A few missing constants are added. The migrateToURI
method is stubbed out

All the previously skipped tests can now be enabled as
normal.

Change-Id: I15efbef8c676cc0e263a9c9bdd7b14dfb3771105
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Make reboot work for halted xenapi instances

Fixes bug 1022199

This also will catch exceptions and make sure to reset the task_state,
while still generating an instance fault.

Change-Id: I122a1422b8e5731bc484414736ab44e60d4c9830
Fix KeyError 'key_name' when KeyPairExists raised.

Updates the Nova compute API to pass a key_name arg to the
KeyPairExists constructor. This fixes an issue where a KeyError
exception would get logged to Nova's api.log file if a KeyPairExists
exception was thrown.

Also removes the un-needed exception explanation argument from the
KeyPairExists constructor.

Fixes LP Bug #1022611

Change-Id: I83ecf3d392fef97649b298d1b732e1ff51145ae4
Fix 'instance %s: snapshotting' log message.

Update the Nova compute manage to remove the '%s:' string from the
log message. Nova already logs teh instance UUID for this log message
because we pass instance_uuid=instance_uuid to the logger so this
extra string isn't required.

Change-Id: I3fa276347d246e440917ac12d4fc5f88d90d7468
Boot from volume for Xen

Implements bp xenapi-boot-from-volume

Ensure boot from volume works for XenAPI (tested using XenServer).
1. Add strip_prefix to block_device to make the command mountpoint
agnostic.
2. Pass block device and delete on terminate information to driver
layer.
3. Add ability to recognize and boot from the specified nova volume.

Change-Id: If117087086eab809217d2b173f921bf9319a52c7
Ignore failure to delete kernel/ramdisk in xenapi driver

Fixes bug 1022681

If deleting the kernel/ramdisk fails because the files don't exist
anymore, then ignore the error and continue. This will ensure that the
instance will get destroyed properly even if the files were deleted
outside of nova.

Change-Id: I5d1f95ea2a6f552c48efbb9e92bb36767df19e34
Fetch kernel/ramdisk images directly

Kernel and ramdisk images don't have a VDI allocated to them, so printing
the UUID in _fetch_image will show None.

[...] Fetched VDIs of type 'ramdisk' with UUID  'None' [...]

Change-Id: I1113606a97b48518e1db61f737633140b0f5eccd
Merge "Ignore failure to delete kernel/ramdisk in xenapi driver"
Merge "Fetch kernel/ramdisk images directly"
Merge "Fix KeyError 'key_name' when KeyPairExists raised."
Merge "Boot from volume for Xen"
Make pep8 test work on Mac

find . -executable is not available on Mac OS X. We switch back to
the old -perm syntax to find files to test.

Change-Id: Iea58a249f282c98ae6cffbe8e6359f70f8b1d63f
Remove deprecated auth-related api extensions

* Delete the accounts and users extensions
* Delete associated tests
* Related to bp remove-deprecated-auth

Change-Id: I429551dbb39ec569c6d2c229fa0c3cafd9e56f11
Merge "Make pep8 test work on Mac"
Merge "Fallback to fakelibvirt in test_libvirt.py test suite"
refactor vmwareapi_conn => vmwareapi/driver

Part of bp:virt-driver-cleanup

Make the vmwareapi driver consistent in naming as a driver
instead of a connection.

Get all the vmware driver parts into the same directory

Change-Id: I7c7e7c391086cf2fc32e8cb85d557005d417042f
refactor xenapi/connection => xenapi/driver

Part of bp:virt-driver-cleanup

Make the xenapi driver consistent in naming as a driver
instead of a connection.

Change-Id: Ibb1485515ff073dd0265969fdcfbfc2665b93fb7
refactor baremetal/proxy => baremetal/driver

Part of bp:virt-driver-cleanup

Make the baremetal driver consistent in naming as a driver
instead of a proxy / connection.

Change-Id: I75d7d90bd8139842b588f1fafb1267511f29a1fb
Merge "Properly track VBD and VDI connections in xenapi fake"