VMware: fix rescue/unrescue instance

Fixes bug 1199955

The problem is due to the way in which the VM's are named on vCenter.
That is, in Nova a VM has a name and a UUID. In vCenter the VM only
has a name. The VM name on vCenter is Nova's instance UUID. When the
rescue/unrescue operation takes place a new VM is spawned/destroyed.
The Nova VM has the name '<name>-rescue'. The problem is that the
new rescue name was not passed correctly to the vCenter, that is,
it should have been '<uuid>-rescue' but it was just '<uuid>'. This
caused the opertaion to fail as there is already a VM with that name
on vCenter. A new name should have been passed which is '<uuid>-rescue'.

Change-Id: Icfe6e5021b29026788bec8f3526f94a8ec0a65e2
Removed code duplication in test_get_server_*_by_id

blueprint api-compute-servers-tests

Change-Id: I3aa8580941984029baf3d39e30b5c0e9b491bc24
Upgrade to Hacking 0.7

There was a bug in hacking 0.6 that broke H202, assertRaises Exception
too broad, so switch to Hacking 0.7 and fix the one H202 bug.

Change-Id: Ia3fb22d1524022479d7068cb84a3bdf7ca19f408
Allow Cinder to specify file format for NFS/GlusterFS

These drivers now have the option of passing a QCOW2 file rather
than a raw file as the volume to attach to the VM.

Required by blueprint qemu-assisted-snapshots

Change-Id: I23929538c7dad65035db5c38ff6e52348925fa27
VMware: Added check for datastore state before selection

The driver only checked for the datastore type. The datastore could
be in an inaccessible state. In such cases creating an instance to
such datastore will fail. The fix to filter out inaccessible data-
stores.

The datastores have a property called accessible. The fix is to use
this property to filter out inaccessible datastores.

fix bug #1194078

Change-Id: I372fc3adc0e89c48d86f1f70164263ed35184c5d
Fix ratelimiting

Current master does not respect ratelimiting, since parsing of the
api-paste.ini is faulty. api-paste.ini limited user limiting by
setting a line as follows:
user:<user-id>:(GET, *, ".*", 4, minute)

This was passed to the Limiter as kwargs with "user" as a key.
Thus multiple user limiting is not possible as well as extracting
the id of the user was bound to fail, since we checked on the key
with startswith("user:")

An example config in the api-paste.ini has to look as follows:
limits = (POST, "*", .*, 10, MINUTE)
limits.<user-id1>:(GET, "*", .*, 4, minute)
limits.<user-id2>:(GET, "*", .*, 2, minute)

The code has been modified to be able to handle such configs

Fixes bug: 1210869

Change-Id: Iaec669b282a567d42fbe21a6f64e7bc99161053b
[v3] Show detail of an quota in API os-quota-sets

nova-manage shows `in_use`, `reserved` including `limit` of a quota.
So create a new API named `detail` to do the same with nova-manage.

The new URL is like :/v3/os-quota-sets/1234/detail.

Fix bug: #1183870

DocImpact

Change-Id: Ic53a68acf0f3f3184c7a900360343bb576560f46
Adds missing V3 API scheduler hints testcase

Adds a testcase for the V3 API scheduler hints extension
which was missed in the initial port

Partially implements blueprint v3-api-unittests

Change-Id: I21fe5f25c806310395bbcd41e6ca84d2c0c02569
xenapi: Added iPXE ISO boot support

This patch adds support for a new kind of Glance image, a specially crafted ISO
which supports iPXE booting, giving customers a means to roll their own image.

Two virt-layer modifications were needed. The first was adding configurations
for the iPXE ISO feature (network to use, boot menu, mkisofs_cmd). The second
was the ability to inject networking info into the ISO after it was
downloaded.

To use this feature, operators should enable the `ipxe_boot` image-property.

DocImpact

Implements blueprint xenapi-ipxe-iso-boot-support

Change-Id: I33acf9dfdff0a5ed9797723a142bc451348e8549
Add alias as prefix to request params for availability_zone v3

fix bug 1215704

DocImpact

Change-Id: I790f49b82eb8a5bccabb8d89eb39436277a0c0ee
Add KeyPair object

This adds a KeyPair object implementation for use by compute_api.

Related to blueprint compute-api-objects

Change-Id: I791dd8e1a624a8c2ccaa409a9feae86fc67d2bad
Make compute_api use KeyPair objects

This makes compute_api's KeypairAPI use KeyPair objects to do
its work. Most of the change here is to tests to account for the
change.

Related to blueprint compute-api-objects

Change-Id: If516a88eac107670d9ae37fcfaf56f2add9dd0c5
Add Service object implementation

This adds a Service object implementation.

Related to blueprint compute-api-objects

Change-Id: I790204448e7f260f6d287efef319104a2f8b36d1
Add ComputeNode object implementation

This adds a ComputeNode object with proper linkage to the Service
object.

Related to blueprint compute-api-objects

Change-Id: I83412a0b07d3a5a0cef1117641e56d02dc41ba6a
Add resource tracking to build_and_run_instance

Resource tracker checking is added so that we have reasonable assurance
of being able to build the instance before it starts.  This allows for a
quick reschedule if the compute node does not have available resources.

This is one part of a series of patches to build up the
build_and_run_instance method.

Part of bp query-scheduler

Change-Id: Ife6e5aef4fda46f74e2db7be1a09b210be397152
Document CONF.default_flavor is for EC2 only

CONF.default_flavor is only used in the EC2 API, so update the help
message to reflect that.

Partial-Bug: #1207553

Change-Id: I3f263c564b619a32a69f5170ab07eddfba77f60b
Fix various cells issues due to object changes

1) Child cell scheduling fails.  The change to use Instance.create() in
child cells broke things.  The instance properties was being overwritten
due to a typo.  I also found a number of other things that need to be
popped out before passing to create_db_entry_for_new_instance().

2) Notification to the API cell was failing.  We cannot pass an object to
instance_update_at_top().

3) When cells is enabled, deleting an instance hits the '_local_delete'
part of code in the API because we don't see the compute node.  There's
a trap in cells_api.py to forward the delete on to child cells, but we
need to make sure not to try to deallocate network in the API cell.

Fixes bug 1216113

Change-Id: Ie989c22cb3b6a1359a0540e60e06fa4153e93476
Merge "VMware: fix rescue/unrescue instance"
Merge "Upgrade to Hacking 0.7"
Merge "Document CONF.default_flavor is for EC2 only"