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
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
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"