GitHub user vdloo opened a pull request:
https://github.com/apache/libcloud/pull/1172
Add image member methods to openstackv2
## Add list image member methods to openstack v2 driver
includes and depends on https://github.com/apache/libcloud/pull/1151
this allows listing image members, see
https://developer.openstack.org/api-ref/image/v2/index.html#sharing. in
openstack you can share images between tenants. when an image is set to
'shared' other tenants can be added as 'member'. all members of an image can be
listed to see which tenants have access and if they have accepted or rejected
the membership yet or if it is still pending. this PR adds the new
NodeImageMember class which contains image id, member id, state and more.
list image members
```
In [6]: conn.ex_list_image_members(image.id)
Out[6]:
[,
...
In [7]: image_member = conn.ex_list_image_members(image.id)[0]
In [8]: dir(image_member)
Out[8]:
['__class__',
'__delattr__',
'__dict__',
'__doc__',
'__format__',
'__getattribute__',
'__hash__',
'__init__',
'__module__',
'__new__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__setattr__',
'__sizeof__',
'__str__',
'__subclasshook__',
'__weakref__',
'_uuid',
'created',
'driver',
'extra',
'get_uuid',
'id',
'image_id',
'state',
'uuid']
In [9]: image_member.extra
Out[9]:
{'created': u'2018-01-12T12:31:50Z',
'schema': u'/v2/schemas/member',
'updated': u'2018-01-12T12:31:54Z'}
```
list image member:
```
In [7]: conn.ex_list_image_member(image.id, member.id)
Out[7]:
```
### Status
- done, ready for review
includes and depends on https://github.com/apache/libcloud/pull/1151
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/vdloo/libcloud
add-image-member-methods-to-openstackv2
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/libcloud/pull/1172.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1172
commit ac2f8939a4e5f3c60e3611a068e9ab56c6cfee24
Author: Rick van de Loo
Date: 2017-12-06T15:54:44Z
implement openstack v2 glance image api
currently the compute driver uses the nova proxy to the glance image api,
but this proxied api is deprecated and can not handle functionality like image
sharing (setting an image to shared, creating new image members and accepting
images as image members). this commit adds a connection to the glance API in
the v2 driver
commit 8c49d8c5bdeb4335e6b29c57df92332f53f48d8a
Author: Rick van de Loo
Date: 2017-12-06T16:23:47Z
use glance api for openstack v2 list_images
commit 3c612ab5ed24ef83029d52c1f377125f56582c66
Author: Rick van de Loo
Date: 2017-12-06T16:43:53Z
add glance endpoint to openstack auth fixture
commit be2e56d43cf06c20c26f47397c33c31cf19cf4ad
Author: Rick van de Loo
Date: 2017-12-06T16:54:04Z
implement openstack ex_update_image
so visibility can be set on images
commit d63950be4946a968576c85be6c0c699f920c246c
Author: Rick van de Loo
Date: 2017-12-06T17:02:40Z
openstack_identity tests check for glance
commit 31db2a37bfa2616cccb579a7bbf6bf643dc6a03e
Author: Rick van de Loo
Date: 2018-02-10T17:08:44Z
add space after if min_ram
> it's surprising to visually group min_ram and min_disk. I guess I
> would have added newlines after the if statements. - pquentin
commit f22a9ec33c656d4c461f2f3c2e0f14e1a5308a8b
Author: Rick van de Loo
Date: 2018-02-10T17:09:58Z
fix OpenStack_2_NodeDriver docstring
> This actually inherits get_image from
> OpenStack_1_1_NodeDriver. - pquentin
commit 7a30d4b404d1add42d9e98f46fb3d80ad3420fbc
Author: Rick van de Loo
Date: 2018-02-10T17:13:10Z
docstr location and ex_only_active OS list_images
commit c64706b0625c265cda27c42d12397e3a2434b7b4
Author: Rick van de Loo
Date: 2018-02-10T17:15:11Z
fix line too long linting errors in OS driver
fixes:
libcloud/compute/drivers/openstack.py:2488:80: E501 line too long (80 > 79
characters)
libcloud/compute/drivers/openstack.py:2489:80: E501 line too long (84 > 79
characters)
libcloud/compute/drivers/openstack.py:2492:80: E501 line too long (82 > 79
characters)
libcloud/compute/drivers/openstack.py:2494:80: E501 line too long (88 > 79
characters)
commit dc50a3011dda02fc4f6d0bd6a385deb2f48c0eb3
Author: Rick van de Loo
Date: 2018-02-10T18:01:49Z
use