Added test cases in ConfKeyManagerTestCase to verify fixed_key.

ConfKeyManagerTestCase sets the fixed_key option, but does not
perform checks to verify it was used.  This patch adds the
appropriate unit test cases to verify the fixed_key option.

Change-Id: I686b095eeb86b67271dc0e3cb5b6acd5a24d3d03
Closes-Bug: #1226228
Remove the unused _validate_device_name()

Since the commit I898ae56539c6101680983d1eca4bce6d92bd5ce6,
_validate_device_name() method has been unused.
This patch removes the method.

Change-Id: I642b71385432801eb8fdd35484fbcb3ed5efa795
xenapi: Cleanup tar process on glance error

Currently, when the network connection to glance is interrupted, there
is different behaviour on upload and download.

This change ensures the behaviour between the two code paths is more
consistent.

Uploads generally need to be given more time before they timeout, so
to keep a single timeout between upload and download, the timeout is
increased to 90 seconds.

At the same time, it ensures the tar process gets killed when any
issues occur with the communication between the hypervisor and
glance.

Change-Id: Id5396e5d3c1052dc2979476a886412da65e08670
Closes-Bug: #1284596
Use debug level logging in unit tests, but don't save them.

We want to try formatting debug level logs so we can gate on any
formatting errors, but we don't want to save the debug level logs as
there are just too many of them. So use fixtures.FakeLogger running at
INFO level and a custom NUllHandler at DEBUG level.

Not Using fixtures level parameter since that sets the log level for the
entire logger and not just the individual handlers.

Don't inherit from logging.NullHandler since it isn't in python2.6

Change-Id: I7317092c0a2bad8efd11ece3ba521d58c2acae42
Allow user to specify image to use during rescue - V2 API changes

This commit includes the V2 changes.
Making changes in v2 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: I985b21264841a6a18a66d19ccd41753f78576776
Remove duplicate code from nova.db.sqlalchemy.utils

There is a lot of code in nova.db.sqlalchemy.utils which is also in
oslo-incubator's openstack.common.db.sqlalchemy.utils module so this
patch goes through and cleans up Nova.

Notable differences:

1. modify_indexes was nova-only but no longer used after the migration
   compaction work, so it's just removed here. It also didn't really
   work for mysql in cases where the index name was too long so it
   could be table-specific and therefore unusable in some mysql cases.
   See commit 029ebab for history.
2. create_shadow_table was not in oslo-incubator and it's also not
   currently used in nova after the migration compaction, however,
   I leave it here in case future migrations in Nova need to use it.
   This patch does replace the usage of _get_not_supported_column in
   create_shadow_table to use the same method from oslo's DB utils.
3. DeleteFromSelect is still used within nova.db.api per
   commit b36826e so we could move it to oslo-incubator but this
   patch leaves it for now since it's only used in Nova.
4. InsertFromSelect was introduced with commit 2e403b2 but now there
   is a copy in oslo-incubator so we can remove our usage in nova.
   However, oslo doesn't have the unit test that nova does, so the
   unit test has been moved to oslo with change I457acf33.
5. Oslo has is_backend_avail and get_connect_string methods so use
   those in test_migrations.py while doing this update.

Closes-Bug: #1280055

Change-Id: Iefa5b4311f1fe1a5da31cf527521c393f2face7c
Pass configured auth strategy to neutronclient

When the token is invalid Nova emits a log trace about an
unknown auth strategy (caused by neutron client). This is a
red herring and is only masking the fact that the token was
unable to be validated in the first place.

Partial-bug: 1297309

Change-Id: Ia3801f80c7ca18674fcf46b5270aa04f6c8c9331
Define constants for the VIF model types

Define constants for the common VIF model types. This will
ensure that all of the drivers will make use of the same values.

Change-Id: I2099bbe92906ac0b1b54f1819113b33565e78980
Remove nova-clear-rabbit-queues

It was already non-functional since
https://review.openstack.org/#/c/40355/

Change-Id: I56b19a49c123b73b6b3a5c4fc5f29864c6fd3b98
Closes-Bug: #1307460
Imported Translations from Transifex

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