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
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
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
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
maint: correct docstring parameter description

Change-Id: I15ad8f17d05c1af3fc2e3b90ed4e71451fdd328d
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
Fix live_migration method's docstring

Update with actual code path.

Change-Id: I5a306773d93affc30fa756a51a34924f60aafa69
Fix infinitely reschedule instance due to miss retry info

The logic of building instance is moved from scheduler to conductor,
But 'retry' info is still populated at scheduler manager, and that
can't be take back from rpc call. This patch moves the retry checking
logic into conductor, and keep the old 'schedule_run_instance'
same as before.

Change-Id: I4efafe815e8623881e6c037eb9d04c0dbb7052a2
Partial-Bug: #1326207
Add deprecation warning to nova baremetal virt driver

We have warnings in the other group C virt drivers and for cells, and
given the baremetal driver is deprecated and slated to be replaced by
the ironic driver, add a deprecation warning to the logs when the
baremetal driver is loaded.

Change-Id: Iaee8b7f7b4d32605e36fd72e893794066727fb65
Don't translate debug level logs in nova

Our translation policy
(https://wiki.openstack.org/wiki/LoggingStandards#Log_Translation) calls
for not translating debug level logs. This is to help prioritize log
translation. Furthermore translation has a performance overhead, even if
the log isn't used (since nova doesn't support lazy translation yet).

This is the final patch ensuring that all fines in the nova directory
no longer have translations for debug messages.

Change-Id: Ib10f5826e2238cbb2d4315c48be570eb31b2ea55
Remove unused code from test_compute_cells

The decorator was introduced in change
I048cc532614c602f3aa6b539fb51e951174e4598 - but it's usage has since
been removed.

Change-Id: Icf00f85a72198aeaf1ac7d32fb492b020399e3b4
Save connection info in libvirt after volume connect

The libvirt driver will connect volumes for BFV while processing
the guest configuration, but not save the connection_info into
the database. This adds a save there to make sure that any
storage driver details get persisted.

Change-Id: Ia99e04ad80a2823a6852debf0919e72b2f93bd26
Related-bug: #1328245
Failure during termination should always leave state as error()

Currently we have a situation where if an instance fails to delete,
instead of having its state reverted, like we do in most places we set
it to error,deleting. This was intentionally done in
I5fb1bbd56035792f566a6e076edfe7a69df006ef. We also intentionally ignore
duplicate requests to delete an instance if its already being deleted
(I2f97f93bd714e0ea3b6d4fa3ac457ab43eed00e1). The combination of these two
things means that if an instance fails to delete for some reason a
tenant is unable to delete that instance.

It turns out this is really bad because instances in deleting state
count against quota, so the tenant slowly looses usable quota.

To fix this, upon a failed termination set the vm_state to error and
revert the task_state. This is a partial revert of
I55742203bdd071c7df90902868e46c2020f799bd.

Change-Id: I55742203bdd071c7df90902868e46c2020f799bd
Closes-Bug: #1329559
Fix object leak in nova.tests.objects.test_fields.TestObject

Call superclass's setUp() before defining new objects so that the object
registry can be saved, and later restored, without the test objects in
it.  This prevents the objects leaking into other tests by way of the
object registry.

Change-Id: If71a055c28c1875e67d826c5c4affda7377d179d
Fix object change detection

The current object change detection actually just hashed the method
argspecs of the remotable decorators instead of the wrapped methods
themselves. This patch fixes that by stashing a pointer to the
original function, which is used for the hash and will be useful
for other inspection-related tasks as well.

This also adds a utility to help when regenerating the hashes,
similar to what we do for API samples. Running the unit tests like
this will give you an object_hashes.txt output file:

  GENERATE_HASHES=y tox TestObjectVersions

Change-Id: Icfe4d6c08f42296c756d1f9ab7c88b52e3209d84