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
Don't return from a finally block

The code in the finally block always executes, even if an exception is
raised. If a return is done, that will cause exceptions to be silently
ignored.

Some unit tests have been failing because of API changes to the
nova.compute.manager:ComputeManager._delete_instance method but the
use of finally/return ended up silently ignoring that error and
caused the test to appear as if it was passing. Another unit test
fails because of a missing uuid attribute.

It could also potentially cause other exceptions to be ignored at
runtime (such as SystemExit) which is likely not the intended
behavior.

Change-Id: I083ee7215296e35a0027be5b3ddf8b764f44cc5b
Closes-bug: 1324277
VMware: remove unused parameters in imagecache

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

Change-Id: Id3c6e8c6c504591fdf09e8871cf3358d265a678c
Check if volume is bootable when creating an instance

Cinder provides a bootable flags for volumes that's not being
checked when creating an instance.

If a user select a non-bootable volume, then the VM became unusable
since nothing will be booted at all.

This check is done only in case that a volume is selected as root
device for a VM.  Boot from snapshot will still work (even that the
volume will be marked as non-bootable by cinder, but will boot the
attached snapshot instead)
If the attribute bootable is not present, we keep the old behaviour
and allow the instance creation.

Change-Id: I8e028d40d6a11beeac4f043afccb17eb61f6ce62
Closes-Bug: #1321334
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
Use no_timer_check with soft-qemu

The Linux kernel timer check not working properly
when the hypervisor's thread preempted by the host CPU scheduler.

The timer check is automatically disabled with other types
of hypervisors including the hardware accelerated kvm,
but timer_check is not disabled when qemu used without hardware acceleration.

This issue is frequently mischaracterized as an SSH connectivity issue and
causes rechecks and occasional boot failures.

This change adds no_timer_check kernel parameter when we are using
uec images with qemu.

Closes-Bug: #1312199
Change-Id: I3cfdfe9048fe219fc12cdac8a399b496f237e55e
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 SecurityGroupAPI use Object instead of instance_get_by_uuid()

This patch makes the SecurityGroupAPI use the SecurityGroup object
for querying the list of security group names instead of pulling
the instance by id, and then following the ['groups'] link.

This is part of a set aimed at deprecating the instance_get_by_uuid()
method on conductor.

Related to blueprint compute-manager-objects-juno

Change-Id: Id69c2019e934cef72c9b06caa503ea74f28720ce
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