Catch InstanceNotFound exceptions for V2 API virtual interfaces

Use the common.get_instance method to get the instance object
in the V2 API virtual interfaces extension rather than call
the compute api directly. The utility function
handes InstanceNotFound exceptions and tranlsates them to HTTPNotFound
rather than letting them propagate up causing a traceback.

Co-Authored-By: Michael Still <mikal@stillhq.com>

Change-Id: I8abee22c53195926e3d2af1da9b14cd9d3608e63
Closes-Bug: 1270804
libvirt: raises exception when attempt to resize disk down

Raises an exception when trying to resize an instance that needs to
resize the disk down.

Change-Id: Ic0a0bede744a1aacd057c5db9de3307b61c525b4
Related-Bug: #1270238
Raise exception if volume snapshot id not found instead of return

In V2 API, if show or delete a snapshot with an unknown id, exception
will be returned instead of raised. Even though correct error
will be returned to client, it's not aligned to other API layer
code, this patch modify it by raise exception instead of return.

Change-Id: I22d4565ca08e1c0ed5041ce903bf6ba918c14cfd
Closes-Bug: #1279189
Port libvirt copy_image tests to mock

Rather than using temporary files, monkey patching and only checking a
subset of utils.execute() arguments, let's use mock.

Change-Id: Ifd1d35d5f44fba16293263bc3b11c405a86aafd4
VMware: Ensure test VM is running in rescue tests

Code was calling get_info() on test VM, but not using it. There are 2
options to fix this:

1. Use it
2. Don't call get_info()

I have chosen option 1.

This change adds a test on the data returned by get_info() which
ensures that the vm just created is in state power_state.RUNNING. The
code later tests that the vm is in state power_state.SHUTDOWN, so the
additional test that it was previously running reinforces that
rescue() caused the shutdown to happen.

Change-Id: Iec58b0dd40702d3bcebf339e9ada8b90a2229d5c
Noted that tox is the preferred unit tester.

This bug and fix is not about deleting run_tests.sh.
The change to delete run_tests.sh has been abandoned.
Thus the documentation of run_tests.sh remains.

Change-Id: Ia0a883260affc56c148dbebc5e3a49acb36b067e
Closes-Bug: #1282393
Fix difference between mysql & psql of flavor-show

If you create a new flavor using a deleted flavorid,
the result of flavor-show is different between mysql and psql.

This issue is caused by the different processing for index in each db.

We need to specify the sort-type to avoid the issue.

Change-Id: Ib1029e80c1b981e1ec86d954b63f83650c9b1cc1
Closes-Bug: #1288636
Libvirt: Repair metadata injection into guests

The change to use Instance objects when spawning instances
changed the format of the 'metadata' property.  But this wasn't
taken into account in the code which actually injects metadata
into /meta.js in the guest's fs.

This patch ensures that the meta.js file injection expects the
new format.

Closes-bug: #1284733

Change-Id: I37049ac01b65d30d588578e351fcddac457f95a7
Cells: Pass instance objects to update/delete_instance_metadata

When nova-cells processes a 'run_compute_api_method' message it pulls
the instance from the local db and calls the appropriate compute api
method with a sqlalchemy model.  Since the update_instance_metadata and
delete_instance_metadata methods in the compute api require objects
these methods are added to the list of methods that will receive an
object.

Change-Id: Iaa5ba6878f0162e2fab8dd3e4b87ea8dd3d527f6
Closes-bug: #1290975
Fixes the Hyper-V agent individual disk metrics

Replaces aggregated metric values with separated values for each disk.

Change-Id: I3c264dfd52572e5c429ee606a47a5727a4a3af3c
Closes-Bug: #1290403
Merge "Raise exception if volume snapshot id not found instead of return"
Merge "VMware: Ensure test VM is running in rescue tests"
Merge "Libvirt: Repair metadata injection into guests"
Merge "Catch InstanceNotFound exceptions for V2 API virtual interfaces"
Merge "libvirt: raises exception when attempt to resize disk down"
Merge "Fix difference between mysql & psql of flavor-show"
Merge "Fixes the Hyper-V agent individual disk metrics"
Merge "Port libvirt copy_image tests to mock"
Merge "Noted that tox is the preferred unit tester."
Merge "Cells: Pass instance objects to update/delete_instance_metadata"