Fix volume lookups in SolidFire template caching
There's a number of issues with the SolidFire template caching
code. There are a number of metadata items that aren't consistent
between Glance API V1 and V2, there's also some problems with how
the code is dealing with it's internal volume and just flat out
wrong account checking.
This patch focuses mainly on fixing up the account and volumeID
issues. The _do_clone method currently expects to find the src
volume under the same account as the dest volume. That's fine
for most cases, but doesn't work for either the SolidFire template
caching, or for the use of generic image caching in Cinder.
We fix that easily by modifying the _get_sf_volume call to have an
option to search all active volumes on the Cluster instead of just
those for a specified account. For now we only change the clone
methods, as they're the only case where we fall into the case of
cross-ownership of volumes in the same context.
The other issue is around the cleanup/delete in the case of a
failed template-volume create. In this case we were passing in
the Cinder UUID to a direct SolidFire API delete cmd, which
is wrong. The direct call for the SolidFire API call requires
that the actual SolidFire ID be used. So we leverage the modified
_get_sf_volume call here as well.
Another issue that was introduced was the introduction of
a connector object to the intialize_connection call. We
got around this once already by just passing in a fake
connector that was actually a string. That was fine, but
the initialize_connection routine also now checks the connector
for multi_attach, so it fails the _get call on a string. We
fix that by just building a dict and using that instead of
a fake string.
Finally, the method of relying on the Glance metadata virt size
has been problematic, it's not set by default, it's not accurate
and it's a bit inefficient. There have been a number of issues
with this method of size determination, so we'll dump that and
just leverage the image_utils methods directly.
Change-Id: Icfd6668389049d3d5686acdb832847aa2d2fce52
Closes-Bug: #
1494830
Closes-Bug: #
1494927