Instance groups: add method get_by_hint

In order to support backward compatibility a new method
'get_by_hint' has been added. This method will check if the
hint is a uuid and if no it will return get_by_uuid else it
will return get_by_name.

Change-Id: I728bf3454dc5a5367e21f242281719c1a967269a
Partial-bug: #1303360
Merge "xenapi: Cleanup tar process on glance error"
Remove unneeded call to fetch network info on shutdown

There is no reason to fetch the network_info from the network api on shutdown
since we can just pull it out of the local cache. There are probably other
places where this call to the network api call can be removed but this patch
just handles the case for shutdown.

Note: the following test was removed 'test_terminate_no_fixed_ips' as
the call to the network api is no longer done so this test would be the
same as test_terminate_no_network.

Closes-bug: #1288392

Change-Id: Ifbf751739c215e566926719f481c03e2c064163a
Make _is_multi_host() use objects

This makes the network api _is_multi_host() method use objects
instead of direct database access so that compute manager can
call it directly.

Note that the previous unit tests for this method used the
random.choice() method to selectively test the is/is-not multihost
case. Unit tests should not be non-deterministic like this, for
coverage and stability reasons. This patch pulls out the two
possibilities for each into separate cases to ensure both are
tested.

Related to blueprint compute-manager-objects-juno

Change-Id: I432a759a666948f2cfaa29d82f749dc9a39141be
Return to using network_api directly for migrations

Previously, we added indirection APIs in conductor to wrap network
methods that still had direct-to-database calls that compute
manager couldn't make. Now that those are cleaned up, we can
remove the use of the indirection layer (and the layer itself from
conductor) and go direct to network_api again.

Related to blueprint compute-manager-objects-juno

Change-Id: Ia76552f49adf9b0d0128f08e3f99953560d8aa64
Convert instance_usage_audit() periodic task to objects

This makes the instance_usage_audit() periodic task use the
InstanceList object to get the list of instances in the window
instead of using a raw conductor api.

Related to blueprint compute-manager-objects-juno

Change-Id: Ib267d742e26b2d4285003619c5e5dedae8ec1035
Deprecate aggregate_host_* operations in conductor

This marks aggregate_host_add() and aggregate_host_delete() as
deprecated in conductor.

Related to blueprint compute-manager-objects-juno

Change-Id: Icb84a730c737160ba194586a523f18c4dcf1c96d
Deprecate network_migrate_instance_* from conductor

This deprecates network_migrate_instance_start() and
network_migrate_instance_finish() from conductor, which are no
longer used.

Related to blueprint compute-manager-objects-juno

Change-Id: I01d7d502e8e8016cef3006ceddbcb31bccc4baf8
remove unneeded call to network_api on rebuild_instance

When rebuilding an instance we call the network_api and which results in
calling neutron and updating the info cache. We do not actually need to
do this as we can get the nw_info directly from the instance's info cache.

Change-Id: I2bcc2f15b1e5bb52d972098c7bc3e12f160b6feb
Closes-bug: 1294914
Fix the explanations of HTTPNotFound for keypair's API

Gets the "explanation" from HTTPNotFound exception and returns
correct message. the commit Ia784e09cda986a421e83c2820dfd0a2267867cdd
has fixed this kind of bug already, but this bug is remained.

Closes-Bug: #1307338
Change-Id: I6811eecba86938e4253f437b7677cb7e4468fd67
Merge "Instance groups: add method get_by_hint"
Disable nova-manage network commands with Neutron V2

When using nova-manage with neutron v2 API, all CRUD operations
should be done directly against the neutron API, rather than
using nova-manage.

Change-Id: I663bd06eb50872f16fc9889dde917277739fefce
Closes-Bug: #1019895
Merge "Return to using network_api directly for migrations"
VMware: Log additional details of suds faults

When a suds requests results in a fault response, the current
code loses details on that fault in the sequence of exceptions
propagated through the driver.  A NoPermission fault will contain
additional metadata on the privilegeId and object type which
needs to be logged.  The fault string will be propagated with this
fix, along with details of a NoPermission fault.

An example of the new exception:
NoPermissionException: Permission to perform this operation was denied.
{u'privilegeId': Resource.AssignVMToPool, u'object': domain-c7}

An example of new exception within retrieveproperties_fault_checker:
Error(s) NoPermission occurred in the call to RetrievePropertiesEx
{'privilegeId': System.Read, 'object': datacenter-16}

Change-Id: Iafbf052750c2835f304b2edf21d7300d1fbd7e5a
Closes-bug: #1289627
Merge "Remove duplicate code from nova.db.sqlalchemy.utils"
Merge "Use debug level logging in unit tests, but don't save them."
Merge "Define constants for the VIF model types"
Use one query instead of two for quota_usages

The second query was unnecessary and not using a proper index. It
seemed to be contributing to a deadlock issue as well.

Change-Id: I1031451b25140d71380c8149d3c83827eec0d4a9
Closes-Bug: #1308715
Co-Authored-by: Chris Behrens <cbehrens@codestud.com>
Merge "Convert instance_usage_audit() periodic task to objects"
Fix up import of conductor

Need to import API from nova.conductor not from nova.conductor.api
directly. This is needed so the is_local flag can be used to
determine the conductor API to use (local or rpc)

Change-Id: I9a45a705a39050b296936edc486db5c2f0aae4dc
Closes-Bug: #1308811