Need to allow quota values to be set to zero

There are test cases in tempest setting the value of quota to '0', we
need allow this scenario.

Fix bug 1191336

Change-Id: I205b523eddfcd3c253172ad4549142ceb9f9ee4e
Remove duplicate test from V3 version of test_hosts

Removes duplicate test_host_startup_service_unavailable
test.

Partially implements blueprint v3-api-unittests

Change-Id: I87327fa577666bcd2924432253d02cd67865e948
Should finish allocating network before VM reaches ACTIVE

This patch can fix issues like tempest caused by async
network allocation. Nova uses NetworkInfoAsyncWrapper
to allocate network in an async manner, and this allows
one to start querying for network info before you know
you will need it. Nova will invoke refresh_cache method
to update instance_cache_info after excuting the
allocate_for_instance method as well.

However, nova rest api will query instance_cache_info
directly, thus maybe get the empty network info before
instance_cache_info table has been updated asynchronously.
Thus will cause VM can exist without a known address
accidentally, the caller is difficult to distinguish
this situation, unless waiting for some internal process
or it will not have an address. So should finish
allocating network before the VM reaches ACTIVE status.
For more detail can refer the bug description.

BTW, almost all create server related unit tests have
coverred this case.

Closes-Bug: #1210483
Change-Id: Iab542df1be7d5c9661d717ec596d2a37b975169a
Add test cases for resume_state_on_host_boot

part of blueprint libvirt-driver-tests

Co-authored-by: Hirofumi Ichihara <ichihara.hirofumi@lab.ntt.co.jp>
Change-Id: I234c3613eb30a593fd1b0e29655551694b7e24f7
Fix changes_since for V3 API

The V3 API changed the changes-since parameter to changes_since
for consistency with other parameters. However, the db level
expects changes-since as the filter. So this change transforms
changes_since to changes-since before passing it to the compute
layer.

Closes-Bug: 1220045

Change-Id: Id34ffe8aa75b20d11dcb1b4a9ba36e2586dae1e3
Increase volume created checking retries to 60

In some cases 30 retries with 1 sec interval is not enough for
volume to be created.
Increased max tries to 60

Fixes bug 1213953

Change-Id: I6bcd395a4bac940387384cc85691d7219cf90e63
Adds V3 API samples for cells and multinic

Adds V3 API samples for cells and multinic extensions.
Bundling them together to save on review load

Partially implements blueprint v3-api-unittests
Partially implements blueprint v3-api-specification

Change-Id: I50840b3d900fbc8ff4f655e4188cc886d7065729
Revert "Importing correlation_id middleware from oslo-incubator"

This reverts commit 26ecf7b02377b860b4412aa554ed2392f42f8d40.

This patch was merged in preparation for
https://review.openstack.org/#/c/29480/ which was never merged.

Change-Id: Iefa1478af03f748ccb5f27f8bd4ad0f5b24af070
xenapi: Fix download_handler fallback

In order to make image-download a bit more robust, we attempt to download from
a preferred handler and if that fails, we fall back to a default handler.

If the preferred handler *is* the default-handler, then we should just raise
the exception instead of retrying.

The existing code was checking to see with whether the handler *instance*
compared as equal to the default-handler *instance*. Since the two objects are
instantiated separately, they'll always be different objects, so never compare
as equal.

The correct check is to see if the handler is an instance of the default
handler's class.

Fixes bug 1210659

Change-Id: Id038d221fd2f90c36673f30d4ff8acdc8dbf098e
Add V3 API samples for instance-actions,extenions

Partially implements blueprint v3-api-unittests

Change-Id: Ie90973734943b3d22cb288b18916a6ef2d9f51de
Clean up check for migration 213

Migration 213 for PCI device needs to check whether the pci_stats column
and the PCI device table exist or not after and before migration.

For pci_stats column check, interface assertColumnExists and
assertColumnNotExists could be used to simplify.

PS: remove an unnecessary word 'image_id' in models.py.

Change-Id: I7f1ba266523bca68c950bd76449324cece09393f
Signed-off-by: Shane Wang <shane.wang@intel.com>
update .mailmap

Change-Id: Ibdad9607e4a046cb0c78b68ae4255679e17ff218
Add missing indexes back in from 152

Migration 152 lost indexes on upgrade. This was fixed in migration 194
and 212 but one index is still missing on the migrations table.

This patch ensures the indexes are present on downgrade of 152 to be
consistent and also adds the missing index back in with a new migration.

Fixes bug 1208652
bp: db-sync-models-with-migrations
Change-Id: I9f42b3fbe891187382135f8e789f13bb2d35d450
Fixes unexpected exception message in PciConfigInvalidWhitelist

When an exception PciConfigInvalidWhitelist occurs, the message "An
unknown exception occurred." was obtained. This is due to the content
of the variable not being overriden correctly. The same typo applies
to PciTrackerInvalidNodeId.

Closes-Bug: #1221493
Change-Id: I589cb8d0a1426eb84bbbc4a819b5585e4e746843
Fixes unexpected exception message in ProjectUserQuotaNotFound

When an exception ProjectUserQuotaNotFound occurs, the message "Quota
could not be found" was obtained. This is because the name of the
variable to override is incorrect. There is a similar bug in
ConsoleTypeUnavailable and ISERTargetNotFoundForVolume.

Change-Id: If709aff55b9042eaca49aaebddc31c366681a36c
Closes-Bug: #1221527
Fixes race cond between delete and confirm resize

If we delete an instance after a confirming resize operation,
and if the instance is deleted firstly at the dest compute node,
then the *_resize dir and network info of this instance will be
left alone on the source compute node, never be cleaned up.
Please refer the bug page to get the reproduce steps

Fixes bug 1202484

Change-Id: Ib1e3d976373bd7f4d086d4f9716b0bca4b383bab
Catch more accuracy exception for _lookup_by_name

When an instance is not found by libvirtd, _lookup_by_name in libvirt
driver raises InstanceNotFound. This patch catchs this exception instead
of NotFound who is the father of InstanceNotFound.

Closes-Bug: #1222663
Change-Id: I1b4ce8f6c44eef29617a42151152cda2159a0088
Add V3 API samples for flavors,flavor-rxtx,flavor-access

Partially implements blueprint v3-api-unittests

Change-Id: I2b572ec13190b946daebec4e64f9b9b362d5ac6e
Add V3 API samples for flavor-manage,flavor-extra-specs

Partially implements bp v3-api-extension-versioning

Change-Id: I54881677005cc085e5a2a604fc83eb4225ffd5d0
Remove unused exceptions

* nova/exception (ImageDownloadModuleLoadError):
Never referenced.
* nova/exception (ISERTargetNotFoundForVolume):
Never referenced.
* nova/exception (InstanceMetadataNotFound):
Unreferenced since commit 0d417fa73
* nova/exception (ISCSITargetNotFoundForVolume):
Unreferenced since commit 4123094b2

This commit removes them.

Change-Id: I224c6b1d711add12320ca8e89486257a6517a1c9