openstacksdk/openstack
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
..
_meta Revert the Proxy metaclass 2018-10-15 13:21:57 -05:00
baremetal Merge "baremetal: support network_data when building configdrive" 2019-02-28 14:54:15 +00:00
block_storage Move image methods to sdk image proxy 2019-02-28 15:10:30 +00:00
cloud Move image methods to sdk image proxy 2019-02-28 15:10:30 +00:00
clustering Merge "Fix resource deletion in clustering" 2019-02-01 21:00:54 +00:00
compute Merge "Rename compute.service.zone to availability_zone" 2019-02-22 18:25:44 +00:00
config Fix syntax error with exception handling 2019-02-21 20:14:23 -05:00
database Merge "use overriden base_path in remaining CRUD operations" 2019-02-01 04:11:19 +00:00
identity Merge "use overriden base_path in remaining CRUD operations" 2019-02-01 04:11:19 +00:00
image Move image methods to sdk image proxy 2019-02-28 15:10:30 +00:00
instance_ha Use pagination detection by default 2019-01-29 10:30:59 +01:00
key_manager Use pagination detection by default 2019-01-29 10:30:59 +01:00
load_balancer Add support for bodyless commits 2019-02-02 10:50:55 -08:00
message Merge "use overriden base_path in remaining CRUD operations" 2019-02-01 04:11:19 +00:00
network Add agent property: resources-synced 2019-02-27 09:57:48 +00:00
object_store Add possibility to override base_path for resource operations 2018-12-20 16:21:42 +01:00
orchestration Use pagination detection by default 2019-01-29 10:30:59 +01:00
tests Move image methods to sdk image proxy 2019-02-28 15:10:30 +00:00
workflow Use pagination detection by default 2019-01-29 10:30:59 +01:00
__init__.py Clean up floating ip tests 2018-05-09 11:09:44 -05:00
__main__.py Add a __main__ handler, version command 2018-11-07 16:04:05 +11:00
_adapter.py Shift swift segment async code out of adapter 2018-11-04 08:38:17 -06:00
_log.py Turn down stevedore and urllib logging 2018-09-22 05:50:49 -05:00
connection.py Merge "Register proxy directly in add_service" 2018-12-10 16:57:14 +00:00
exceptions.py Fixes for Unicode characters in python 2 requests 2019-01-28 11:07:37 +01:00
format.py Remove type=timestamp usages 2016-06-08 16:17:48 -04:00
proxy.py Use pagination detection by default 2019-01-29 10:30:59 +01:00
resource.py Merge "Make all resource locations process project_id" 2019-02-22 18:25:43 +00:00
service_description.py Fix for not released thread in service_description 2019-01-13 21:39:05 +02:00
task_manager.py Merge "Fix latest flake8 issues" 2018-10-31 19:44:30 +00:00
utils.py Fixes for Unicode characters in python 2 requests 2019-01-28 11:07:37 +01:00
version.py Move version definition 2016-06-03 09:32:26 -04:00