add get_by_metadata_key to AggregateList object

This change adds the get_by_metadata_key function to the AggregateList object
and the aggregate_get_by_metadata_key function to the DB API.

Previously, the only DB API function available for finding aggregates matching
a metadata key returned a dictionary of aggregated metadata. The
aggregate_get_by_metadata_key function returns all rows matching the specified
metadata key, and is called by the existing aggregate_host_get_by_metadata_key
DB API function.

The get_by_metadata_key function returns a list of Aggregate objects matching
the specified metadata key.

Related to blueprint compute-manager-objects-juno

Change-Id: If50c9f613dd192ab44577f26a81dd5b40e3a7af7
libvirt+lxc: Unmount guest FS from host on error

If an error occurs during `_create_domain`, we need to ensure that the guest's
FS is unmounted from the host in all cases.

This is necessary because, if we leave the FS mounted to the host, the
`lvremove` triggered by `delete` won't work because the filesystem will
'still be in use'.

The solution is to wrap the code in a `try/finally` to ensure the cleanup
routines (which unmount) are always called.

Change-Id: If863cf813dddc1e4554fb87b945c68b75b25f9a2
Closes-Bug: 1333827
Correct use of nova.image.glance in compute API

The nova.api.openstack.compute.images modules was using the
nova.image.glance module directly, instead of using the new,
standardized nova.image.API module.

This patch corrects that usage and updates the associated unit tests to
use mock instead of the nova.tests.api.fake.stub_out_glance() method.

Copies the nova.tests.api.fake._make_image_fixtures() call to a new
nova.tests.image_fixtures module, and corrects a number of errors in the
original function, including not returning datetime objects for
timestamp fields (as the nova.image.API returns) and ensuring that the
ID field is a string in the returned fixture dicts.

The _make_image_fixtures() function and the stub_out_glance() function
will be removed in the next patch, which fixes up the image_metadata
module, which is the last unit test that uses them.

Change-Id: Icd22ff3f438b8ba476f2637c7d4129ea6d0f45e8
Fix unit tests related to cloudpipe_update

In some unit tests related to cloudpipe_update, there are two negative
factors(ex. bad url and bad body) and current tests don't verify its
purposes. This patch removes unnecessary factor.

Change-Id: I5e78b47e6f4c7359a7f0c16898a26e3649d92eb2
Fix error status code for cloudpipe_update

When passing bad body in a request, most APIs return BadRequest response.
However, cloudpipe_update API doesn't do it.
This patch fixes the error status code and adds a unit test related to
this change.

Change-Id: I16a48e6913f52baa870e04196529fda619c03098
Remove unneeded calls in test_shelve to start instances

During running of tox the system can timeout on slower systems.  This
is due to rpc calls to other threads failing in testing.  This
particular case involved shelving calls to start instances.  However,
when we started using objects, these calls became unnecessary for these
unit tests.  Thus we are removing the calls which should remove
the traceback for slow systems.

Change-Id: I52f1e86815cc2cac8dc31865f00eef2d4ffeea59
Partial-Bug: 1311778
Updated from global requirements

Change-Id: Ie52204a9bbfd3e608a947f71dd3f406129aa9533
Return status for compute node

Currently when return compute node information, there is no status returned.

When the corresponding service is disabled or down and users try to
do 'hypervisor-list' or 'hypervisor-show', they will have no idea of it.

Implements: blueprint return-status-for-hypervisor-node
Closes-Bug: #1285259

DocImpact

Change-Id: I17c53b454ccef023f298f1b8875daef965d2325d
Merge "Remove unneeded calls in test_shelve to start instances"
Merge "libvirt+lxc: Unmount guest FS from host on error"
Merge "Updated from global requirements"
Merge "Return status for compute node"
Merge "add get_by_metadata_key to AggregateList object"
Merge "Fix unit tests related to cloudpipe_update"
Merge "Fix error status code for cloudpipe_update"
Merge "Correct use of nova.image.glance in compute API"