Adds v3 API samples for limits and simple tenant usage

Adds the v3 API samples for the limits and simple tenant
usage extensions. Bundled together to reduce review load

Partially implements blueprint v3-api-specification

+DocImpact

Change-Id: I1b73d7acf8d1bbccec2fff6180799edd3f3b12aa
disable direct mounting of qcow2 images by default

* nova/virt/disk/api.py: Set the default for the
'resize_fs_using_block_device' option to False,
so that we don't enable this functionality because:
1. It's not needed for newer images that resize themselves.
2. It enables direct mounting of images which might otherwise
   be disabled for security reasons.
3. It's not supported on systems without the nbd module.
4. It gives noisy diagnostics on such systems.

Fixes bug: 1212734

Change-Id: Ifbd687eae46606176ea196888eeffdde08559c01
Enable test_create_multiple_servers test for V3 API

Now that the multiple create extension has merged we can enable
this test for the V3 API. Need to also override post_server
for the test client for the V3 API as the data return when requesting
a reservation id in the V3 API has changed

Change-Id: I7f34f1e90b872c4679b5c54fe9e4b0f4420910ab
Closes-Bug: #1206884
disassociate_address response should match ec2

The current behavior of disassociate_address does not match that of
what EC2 would return when calling it upon an unassociated address.
In EC2 when disassociate_address is called on an unassociated
address, it returns successfully as such:

<DisassociateAddressResponse
    xmlns="http://EC2.amazonaws.com/doc/2012-08-15/">
    <requestId>aabbccdd-0146-4952-bdbe-710e4fee8387</requestId>
    <return>true</return>
</DisassociateAddressResponse>

However, when this same called is made against the OpenStack EC2
implementation, this would return a 400:

<Response><Errors><Error><Code>InvalidInstanceID.NotFound</Code>
<Message>Instance None could not be found.</Message></Error></Errors>
<RequestID>req-7a9b4d03-b9f5-4243-95d8-f1ccab180631</RequestID>
</Response>

This is due to the fact that we continue to attempt disassociation
despite instance_id == None.

Modify this behavior to match EC2 by simply checking that instance_id
is set before continuing disassociation. Else, bail early, and in
either case report success.

This change also modifies unit tests to account for this change.

Change-Id: I17c822d70918fefa55da2ab096af5b98b87e23e7
Closes-Bug: #1224251
Add debugging to ComputeCapabilitiesFilter

When ComputeCapabilitiesFilter fails to match an extra_spec its hard to
debug which requirement is missing, add a LOG.debug statement to make
life easier.

Change-Id: I5d24d6ceee92611af112c2fbac1564cc3f9bf838
VMwareVCDriver Fix sparse disk copy error on spawn

The same approach of calling VirtualDiskManager.CopyVirtualDisk
without destination disk spec in the cluster driver for fixing 1184807
turns out to work for copying a sparse disk as well because vCenter's behavior
for specless copy is to do the reasonable thing of converting a sparse disk to
thin-provisioned, and a flat disk to preallocated.

Tests done:

Verified using tempest that sparse/thin/preallocated image types deploys
properly through the cluster driver. Tempest output to be included in
the review comments.

Fixes bug 1171226

Change-Id: I6c48866e06c2aa656c89848564f3262fb7b79039
Convert TestCases to NoDBTestCase

NoDBTestCase is faster because it skips initializing a database for
tests which don't actually talk to the database. Its also nicer
because its more explicit about the dependancies of a given test.
This is a second pass at moving test cases over to the database
lacking version, but further work is required here.

Partial-Bug: 1227473

Change-Id: I16313b8febb8a3c681fdf7e7278cc5a09138e542
Convert TestCases to NoDBTestCase

NoDBTestCase is faster because it skips initializing a database for
tests which don't actually talk to the database. Its also nicer
because its more explicit about the dependancies of a given test.
This is a third pass at moving test cases over to the database
lacking version, but further work is required here.

Change-Id: Ibbe86329c846e9d6df16f3bbe53a75efff6fd604
Partial-Bug: 1227473
Convert TestCases to NoDBTestCase

NoDBTestCase is faster because it skips initializing a database for
tests which don't actually talk to the database. Its also nicer
because its more explicit about the dependancies of a given test.
This is the final pass at moving test cases over to the database
lacking version.

Change-Id: Iba5ec1f5c0a5724f01779eb5b0f164c4e232632a
Closes-Bug: 1227473
libvirt: add test case for _hard_reboot

Closes-bug: #1228763
Co-authored-by: Jian Wen <jian.wen@canonical.com>
Change-Id: I3650ad354353c8a1bd7a6498c42f6745b22f5192
Fix V3 API server metadata XML serialization

The XML serialisation and deserialization when updating
a single server metadata item or retrieving a single server metadata
item through the V3 API is broken as the JSON format was changed
but the corresponding XML serialisation/deserialisation wasn't.

This changeset fixes this bug and adds testcases for the fixes.

Change-Id: I1bd2a729744387337f86a37dc2ff89606edce424
Closes-Bug: #1223803
Adds v3 API samples for ips and server_metadata extensions

DocImpact

Change-Id: I3774db2ab59335e0f8543c4563028b0c35234dc9
Bring up interface when enslaving to a bridge

Right now, if the interface to be used for a nova-network bridge is
not already up, nova-network will enslave it and leave it down,
which is not very helpful. Since an interface for this purpose is
likely to be left unconfigured by the base OS, expecting it to be
up is not ideal.

Change-Id: I14564c0bcb55b9dd427ccaa8fb217e38121d4b71
Closes-bug: 1228183
Fix SecurityGroupsOutputTest v3 security group tests

SecurityGroupsOutputTest was testing with security_group_api set to
neturon instead of nova. In addition, this patch fixes the tests to
match the v2 tests which tested more then the name matching 'fake'.

Fixes bug: 1229515

Change-Id: I5b1de35add3b8a131b9077c1c9396ae70d2faefa
Added 'page_size' param to image list

Added a new query param called 'page_size' to
accepted_query_params list in image list call.
This param is passed on to glance-client which will
be used to paginate the result set.

Fixes bug 1200233

Change-Id: I1c804c74c153e80bb572ec45283ebd9b6b7b41c5
Add v3 API samples for rescue

Partially implements blueprint v3-api-unittests

Change-Id: I467e0f1ab5758f81698664ca198ebab0eb979cf4
Remove exceptions.Duplicate

exceptions.Duplicate is largely unused (one fake and one use in
cloudpipe). We should replace those users with more specific
exceptions and then remove exceptions.Duplicate.

Closes-Bug: 1228953
Change-Id: I0e7b4bae5728600fb81511a05778419b3e5577df
VMware: fix bug with booting from volume

When booting from volume ensure that the volume is on the same
datastore as the instance being booted.

Fixes bug 1223709

Change-Id: Iddb70cdd7e358c401ef4f0b4d9e66b9655c2feeb
Fix several flake8 issues in the plugins/xenserver code

Due to some issues in the gate, several flake8 errors got merged
recently. This patch fixes the most recent issues found.

For the H304 relative import errors, we have to skip those because they
are put into /etc/xensource/scripts which is the current working
directory when running the plugin.

For the H231 incompatible python 3 'except x,y' construct, we have to
skip those because this code is written to run on python 2.4 and 'except
x as y' does not work with python 2.4.

Note that in cleaning up some of the H304 failures for relative imports,
I also re-arranged the imports to follow the hacking guide of doing
standard library packages first, then third party packages, and finally
nova-specific packages.

Closes-Bug: #1229753

Change-Id: I1c2211fd6a10d43d7e65cdb4e18530397788cf2c
Merge "Bring up interface when enslaving to a bridge"