Remove deprecated config option names: Juno Edition

Just like the beginning of every other release, remove the deprecated
config option aliases that were marked as deprecated in Icehouse.

Equivalent Icehouse patch: I64548e40f6cea42275a6f0f3ebdc0c4cd9324804

DocImpact: Configurations that were deprecated in the Icehouse release are not
recognized in Juno.

Change-Id: I346ee0248c03e60716bd7dc4a5ee4493610867cb
Improve performance for checking hosts AZs

When updating aggregate metadata or when adding a host into aggregate,
a check is done to make sure that hosts can't be in multiple AZs.

In order to do the check, the routine was looping over each host to look
in the DB which AZs the host is part of.
As it's quite hungry in terms of DB accesses, here the proposal is to
extend the helper method for getting all AZs by also having their hosts,
and so only do memory iterations.

Partial-Bug: #1277230

Change-Id: I7c5bc980acb17f0a0e1f8c1403dac66c305866fb
Delete image when backup operation failed on snapshot step

when we snapshot an instance, we will use @delete_image_on_error to
delete any failed snapshot, however, the image will not be removed
by backup code flow, it will be an issue if too many backup failed
at last ,all useful image will be removed and we have only 'error'
image left in host

Change-Id: Ib527ade86aef52a8445b57fa03fed434578c4204
Closes-Bug: #1288574
Shrink devref.unit_tests, since info is in wiki.

Don't keep a copy of the run_tests.sh flag list here since it
inevitably will get out of sync with the real list.

No need to go into detail on how unit testing is set up, since we already have a wiki
on how to run tests that applies for all OpenStack projects. Keep
section with tox examples since that is the most commonly used command.

Change-Id: Ia8eb059be164d9df3edfd69aedcebfd028da45ff
Related-Bug: 1219040
minor corrections to devref rpc page

Correct wording to proper English and remove extra space between words while
in there.

DocImpact

Change-Id: If4b3d9d81d7193107e84867e4ab713c413a4976d
Properly skip coreutils readlink tests

Some tests in VirtDiskVFSLocalFSTestPaths class are skipped
if we're running on OSX by doing a check using is_osx() function
from tests.utils. However, these tests actually require readlink
from coreutils, so replace OS X check by more general check
for coreutils readlink presence.

This change allows to run a complete test suite on OSes rather than
Linux and OSX, such as FreeBSD.

These tests were the only consumer of tests.utils.is_osx, but
it's kept because it could be still potentially useful.

Change-Id: I7593560b84bda3719de811fbc214b1f52e1a121f
Correct exception info format of v3 flavor manage

The existing flavor manage may raise HTTPBadRequest exception,
But the msg info didn't use '_' prefix. This patch adds it.

Change-Id: I736bf4b0e78ecc0bb753d376ee162f19fafc09e1
Adds IVS unit tests for new VIF firewall logic

Adds new unit tests for the IVS VIF driver to
cover the various possible plugging behaviors
added by the vif_details based logic introduced
in change I3bbcfc67036ab7389c82720add0bc0fc627bfee0.

Closes-Bug: #1301087
Change-Id: I7f0a1460b948a852c2d61d24217bbf27a4d85859
VMware: remove unused parameters in imagecache

Trivial patch to remove some unused parameters in
timestamp_cleanup().

Change-Id: Id3c6e8c6c504591fdf09e8871cf3358d265a678c
Allow user to specify image to use during rescue - V3 API changes

This commit includes the V3 changes.
Making changes in V3 API to take an extra parameter rescue_image_ref
as part of the rescue action API.
If specified, this image_ref will be used to rescue the instance.
If the image is not specified, then the base image ref is used by
default.

Partially Implements: blueprint allow-image-to-be-specified-during-rescue

DocImpact

Change-Id: I7a9d88bf4dfe73879247f5b82a52928fdde76510
Add tests to avoid inconsistent extension names

On v2.1/v3 API, extension names should be camelcases.
I0dc6c23ffcdcf97fc52d3575d521692805ffd9e3 has fixed inconsistent
names already.
This patch adds tests for blocking these inconsistent name/alias
additions in the future.

Change-Id: I3c9ee3f59fd17394b251fedf8df592e5d6304962
Related-Bug: #1315597
Fix api direct use of instance module objects

This switches the nova/api and nova/tests/api code to use
nova.objects.Instance* vs nova.objects.instance.Instance*.

Partial-Blueprint: object-subclassing

Change-Id: I146f1d082fa37e1a5c09aa8c5363746daffbc219
Make metadata password routines use Instance object

This replaces existing uses of raw conductor apis for get_by_uuid()
and instance_update() with objects.

Related to blueprint compute-manager-objects-juno

Change-Id: I63cf0ac6636e17f2bfcd9d6a859d9ed8612a56e1
Deprecate instance_get_by_uuid() from conductor

Aside from a few trivial-to-fix places in the unit tests, the
conductor instance_get_by_uuid() method is no longer used. This
deprecates it and cleans up the few places that were trivially
touching it.

Related to blueprint compute-manager-objects-juno

Change-Id: Iab48856c0432af0b9483e9868c2e235de75fdd51
Check the length of aggregate metadata

PostgreSQL gives an error if you try to shove 256+ characters
into a 255-character field. So we need raise a HTTPBadRequest
explanation if the length of aggregate_metadata.keys or
aggregate_metadata.values is above 255.

Change-Id: I2c778f2237ba5bd2aa8335a0eae80f3aad3e9157
Closes-Bug: #1219693
libvirt: convert cpu features attribute from list to a set

Currently, the cpu features list which is being sent to libvirt,
when creating a domain or calling compareCPU, must contain only
unique entries. Multiple issues arise when we are updating the
features attribute in LibvirtConfigCPU class (for example during
migration).

This change will change the features attribute from being a list
to a set. This make the LibvirtConfigCPU class keep only unique
features.
Adjusting the LibvirtConfigCPUFeature class to support set
operations by overriding the __eq__, __ne__ and __hash__
methods.

Closes-Bug: #1303536
Change-Id: I6350fe0e827c860aea77cc4fe56f18f5c1483580
libvirt: Make nwfilter driver use right filterref

This fixes Bug #1220856 which occurs with Libvirt NWFilterFirewall
Driver.  While creating a VM with multiple NICs including one connects
to DHCP serving network and another to DHCP non-serving network,
NWFilterFirewall Driver will use the same base filter that allows DHCP
for all NICs. This leads a libvirt launch error due to lack of
'dhcp_server' parameter which is needed to define allow-DHCP filters.

This patch makes NWFilterFirewall Driver use right base filter for
each NIC depends on 'dhcp_server' config.

Closes-bug: #1220856
Change-Id: I7f9a7c281f152985478b2ec295f0644ba475fd76
Add unit tests for ipv4/ipv6 format validation

We found a bug that the other jsonschema format check('uri') did
not work for input validation. There was not any unit tests for
the format check, then we could not find it in long term.
The bug is fixed with Ibb2b7f27c374136e6865b28786d10ca1365e5709 .
And this patch adds unit tests for the format 'ipv4' and 'ipv6'.

Change-Id: I6f6636708e3f9a4eee14451f2baacb50002f1db8
Related-Bug: #1326599
Network: add instance to the debug statement

Allocating and deallocating a network from an instance needs
more info to debug especially when more than one instance
has the same name.

The same change is also made regarding exceptions. That is,
the instance UUID will be used instead of the name.

Change-Id: I624fe77c71f6cb7ca453c863b59f0452c8e6b383
Make sure domain exists before referencing it

Before calling domain.destroy() in the exception handler for a failed
create attempt, make sure domain was created prior to when the
exception was thrown.

Change-Id: I3b7c5afce7f3bacce1b444c245b035334962ff7c
Closes-Bug: #1326998