openstacksdk/openstack/cloud
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
..
_heat Fix latest flake8 issues 2018-10-29 16:44:05 -05:00
cmd Fix openstack-inventory 2018-04-23 22:40:28 +02:00
tests Merge tox, tests and other support files 2017-10-04 14:51:08 -05:00
__init__.py Make it clear that OpenStackCloud is a mixin 2018-10-15 13:21:57 -05:00
_normalize.py Compute location properly in server 2019-01-11 20:18:53 +00:00
_utils.py Fix dogpile.cache 0.7.0 interaction 2018-12-18 02:29:27 +00:00
exc.py Port wait_for_ methods to use iterate_timeout 2018-01-09 12:00:54 -06:00
inventory.py Clean up floating ip tests 2018-05-09 11:09:44 -05:00
meta.py Fix latest flake8 issues 2018-10-29 16:44:05 -05:00
openstackcloud.py Move image methods to sdk image proxy 2019-02-28 15:10:30 +00:00