We have excellent image uploading code - people should get to use it
whether they use the abstraction layer or not.
The sdk is version specific, so we can split v1 and v2 using those
classes. Make a base class for both proxies so that we can define a
general interface and handle some of the argument normalization
and processing.
NOTE: This is very unfinished. The proxy methods should be transformed
to using the Resource layer. There are many places where calls back in
to the Connection haven't had self._connection pre-pended to them.
The wait logic needs to be reworked. We should make a v2.ImageTask
resource (I think) with a wait method - and a v2.Image with a
wait method so that we can have a proxy wait_for_image method that will
work fully for put and task. Then we should remove the wait loops from
the shade layer and have it call self.image.wait_for_image(image) if
wait/timeout have been passed.
At the end of this, create_image in shade should basically be:
if volume:
self.block_storage.create_image()
else:
self.image.create_image()
if wait:
self.image.wait_for_image(wait, timeout)
This is also a straw man for a general approach to shifting important
logic into the sdk layer so that it can be shared, but also keep things
like the wait/timeout and "call image or block-storage api calls"
in shade.
The block_storage.create_image is going to be interesting - because it
realy needs to return an Image resource. I think the existing code is
racey/buggy - because for not-wait it returns get_image(image_id) - but
I'm pretty sure that can't possibly be guaranteed to exist that instant.
However, with Image resource we can just create a blank Image object
with image_id filled in, and that blank object can be used as a
parameter to wait_for_image.
Change-Id: Idfeb25e8d6b20d7f5ea218aaf05af9a52fb1cfb8