Fix race between aggregate list and delete

Previously, during get_aggregate_list() if an aggregate was deleted
after the list of aggregates is initially read from the database
with db.get_aggregate_all() then the list method would raise an
AggregateNotFound when it called _get_aggregates_info(), which makes
additional db queries for each aggregate. This would result in the api
request receiving a 404 response. However db.get_aggregate_all()
already contained all the required information for the aggregate
list.

This commit changes renames _get_aggregate_info() to
_reformat_aggregate_info() which just correctly parse the response of
db.get_aggregate_get() and formats its response in the same way as
_get_aggregates_info() would return with the extra database queries.
This fixes the race condition not only in list but potentially in
other calls by only making one database read for any get operation.

Also, the unit tests added in this commit are to fill a coverage gap
with get_aggregate_list() and to ensure that we don't change the
behavior of list while fixing the race condition. The race condition
is not directly testable in unit tests because it requires a
multithreaded environment to send a delete immediately after a list
call. It was uncovered by running tempest in parallel with testr.

Fixes bug 1204598

Change-Id: I5f872c7ac89334fc3914906831ed8f2a58881543
Merge "Fix race between aggregate list and delete"