Fix logic for aggregate_metadata_get_by_host_with_key test case

After deleting a3 metadata, it is the host that once has such metadata
should be tested.

Change-Id: I79c40aa977911cd327d478ad8d9f147e19325017
Remove warn log in quota function on API layer

An API layer function in quotas print warn message when in input
is not valid, it's useless since an exception will be raised.

Change-Id: I707416aae29e56ad1c7d2cc55ca8c662bf5547f5
Ignore InstanceNotFound while getting console output

During we cold-migrating or resizing an instance to another host,
or during deleting it, the get_console_output method may raise an
InstanceNotFound excetpion if the instance is not on the hypervisor,
this is an expected error, so we should add it to expected
exceptions list in compute manager.

Closes-bug: #1292339
Change-Id: I23a99438d73826f01ff5662130dcbfa72dc39a6e
Improved logs for add/remove security group rules.

Added more details - protocol and port information to AUDIT log
messages on add/remove rule actions for security groups.

Change-Id: Ib446a63976dade90c51c13f30367a3ee17a739ea
Closes-Bug: #1154303
Rename instance_actions v3 to server_actions

* Renames the os-instance_actions v3 plugin to os-server-actions
* Also modifies api specific tests and expected user input JSON
* DocImpact only for v3 Nova api documentation for this plugin.

Closes-Bug: #1206032

DocImpact

Change-Id: Id5049e10f5ef540d0d8e3871d800e9d9cb33da73
Remove unnecessary passing of task_state to check_instance_state

Remove cases where task_state=[None] was passed to check_instance_state
when that is essentially the default value anyway

Change-Id: I49b6449b9ae43a5cfcf5a1ccac5ee9a64d2b3f3c
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
VMWare - Check for compute node before triggering destroy

While booting an instance, if Claim on that compute node is not successful
compute manager triggers a call to destroy instance. Destroy fails since the
compute node (Cluster/ESX host) is set only after claim is successful.
Hence the check for node is made before destroy, to ensure that exception
does not get thrown. This ensures that the instance gets rescheduled
Closes-Bug: #1307408

Change-Id: Iaaf931e9c1e6cf046497e2c64952f92e802ad4be
VMware: remove unused variable

The flag was never used since it was added in commit
24d609447399e468937f8a278854690864ffabcd

Change-Id: Ia034ccff1220783c2dd8c37c76fce24063f12682
Deprecate nova-manage flavor subcommand

The nova client already has the following flavor commands:

flavor-access-add    Add flavor access for the given tenant.
flavor-access-list   Print access information about the given flavor.
flavor-access-remove Remove flavor access for the given tenant.
flavor-create        Create a new flavor
flavor-delete        Delete a specific flavor
flavor-key           Set or unset extra_spec for a flavor.
flavor-list          Print a list of available 'flavors' (sizes of
flavor-show          Show details about the given flavor.

This covers what nova-manage flavor was providing so let's deprecate the
legacy nova-manage subcommand and mark it for removal in the K release.

There is not a bug or blueprint for this. The flavor subcommand is
completely duplicated in nova client. It is accessing the database
directly and we want to move to using flavor objects which would go
through conductor. So this could be considered part of the objects
conversion for flavors.

For some other commands like service, db and host it makes sense to
leave those so you can access the database before the api service is
running, but that's not the case for flavors.

UpgradeImpact: nova-manage flavor command is deprecated, use nova client

Change-Id: I8709bc9af4e490142e44c6dc61fd0aaa3a392b68
Make instance_exists() take an instance, not instance_name

Some virt drivers may not support/need to use instance.name and have
a different way to find out if an instance exists. NOTE: this still
uses dict access on instance, as the _run_instance() path is not
converted to Instance objects yet.

NOTE: This also removes a duplicate call to self._lookup_by_name()
in libvirt's resume_state_on_host_boot(). It was calling
self.instance_exists() and then self._lookup_by_name(), but instance_exists()
calls _lookup_by_name() itself.

Change-Id: I701cb5416ec47262268d1a088018b6be2774d1c5
Correct the log in conductor unshelve_instance

The log in conductor unshelve_instance is not correct, this patch
adjust it.

Change-Id: I9706862fa39d3c9cb5af0d412368546b504bc4a5
Fix a typo in compute/manager::remove_volume_connection()

A typo made in the placement of a paren in a recent refactoring
resulted in definitely broken code. Unfortunately, this was not
in a tested path and so went unnoticed. This adds a test and fixes
the problem.

Change-Id: Id24169894ffda6da0301d1dc38b2f2bb29ebbd58
Remove comments and to-do for quota inconsistency

There are comments for quota inconsistency in function
_complete_deletion and considering race conditions.

_complete_deletion was called by _complete_partial_deletion
and_delete_instance only if the instance state is DELETED
compute can enter _complete_partial_deletion
while if _complete_deletion called in _delete_instance,
that means instance vm state already become DELETED

also, if the _delete_instance was called with instance
state SOFT_DELETED, the quotas.rollback() will be called
it will make quotas.commit later take no effect
since the quotas.reservations is already None

so there is no race conditions and the comments can be removed

Change-Id: Iddb9e5197ca7ca9bd4692d63bb5c7f9a2ab44be5
Partial-Bug: #1296414
VMware: spawn refactor - phase 1 - get_vif_info

get_vif_info converts OpenStacks nova network_info
into a data structure that is used to prepare the
configuration spec for the instance that is being deployed.

partial blueprint vmware-spawn-refactor

Change-Id: I5d1535e84de44a995e1605d0d5b850c9756612de
Imported Translations from Transifex

Change-Id: I3fc3ca67a6d8c927b61999a134eb8a9a1e133e6e
DescribeInstances in ec2 shows wrong image-message

If one instance boots from a volume,
the value of 'image_id' by 'DescribeInstances' in ec2,
will be a wrong number.

The value of 'image_ref' for this type of instances, is '', not None.
So the original protected codes can't take efforts.

Change-Id: I8c5e1c626f2b7873e7720f3615db1ee1ec6c681a
Closes-Bug: #1278696
Fix exception message being changed by nested exception

Minor change to avoid having the error message changed in the
_build_instance exception handler if an exception occurs during
network cleanup.

Change-Id: Ica7afc76f1fd261541ff9cf03b6c5e079e9404f8
libvirt: fix comment for get_num_instances

The comment had an invalid function name.

Change-Id: Iea10186a6cd649a42dadc631bef5f0e32fe2f479
Deprecate instance_destroy() from conductor

This deprecates the instance_destroy() method from conductor,
which is no longer used.

Related to blueprint compute-manager-objects-juno

Change-Id: Ifa0ef5fa3c1bf834be7e8f6bebe2a8ebcae9147e