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
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
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
Skip migrations test_walk_versions instead of pass

When there is no db engine configured for the migration tests,
the test_walk_versions test was passing, rather than skipping,
because it contained a for-loop and no check for the length of the
sequence being iterated over.
This patch checks the length of the configured engines and
properly skips the test when there are no engines.

Change-Id: I4078655f01638c22cf029f088018b8be93d6a01a
Co-Authored-By: Devananda van der Veen<devananda.vdv@gmail.com>
Closes-bug: #1327397
Prevent clean-up of migrating instances on compute init

During compute manager startup init_host is called. One
of the functions this carries out is to delete instance
data that doesn't belong to this host this function only
checks if the local instance belongs to the host or not.
It doesn't check the task_state. This could result in the
loss of all instance data if it occured at the wrong
point during live migration.

This change checks if the task_state of the instance to
be deleted is MIGRATING and if so it does not delete the
instance. Similarily for the task state RESIZE_MIGRATING.

Change-Id: Ia8c67acf93d71af868907f0711dcc1dfe103560c
Closes-Bug: 1319797
Add more logging to nova-network.

As requested to help debug gate issues.

Related-Bug: #1298472

Change-Id: I5640df721345fe9a878c7c6f8e1c13cfed484112
Merge "libvirt: convert cpu features attribute from list to a set"
Merge "Fix api direct use of instance module objects"
Merge "Skip migrations test_walk_versions instead of pass"
Merge "Save connection info in libvirt after volume connect"
Merge "Failure during termination should always leave state as error()"
Merge "Add more logging to nova-network."
Merge "Prevent clean-up of migrating instances on compute init"