openstacksdk/openstack/block_storage/v2
Artem Goncharov 232553daf7 Move image methods to sdk image proxy
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
2019-02-28 15:10:30 +00:00
..
__init__.py Rework config and rest layers 2017-11-15 11:46:50 -06:00
_proxy.py Move image methods to sdk image proxy 2019-02-28 15:10:30 +00:00
backup.py implement block-storage backup resource 2018-11-16 10:20:56 +01:00
snapshot.py Explicit set capabilities in VolumeDetail and SnapshotDetail 2018-10-31 20:08:06 -05:00
stats.py Use discovery instead of config to create proxies 2018-10-06 07:44:29 -05:00
type.py Support non-public volume types 2018-12-03 16:18:34 +00:00
volume.py Explicit set capabilities in VolumeDetail and SnapshotDetail 2018-10-31 20:08:06 -05:00