After sharing an image with consumer, owner id is assigned as consumer project id

Bug #1800689 reported by Chhavi Agarwal
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Invalid
Undecided
Unassigned

Bug Description

[root@ip9-114-192-143 ~]# openstack image show rhel-svc
---------------------------------------------------------------+
| checksum | d41d8cd98f00b204e9800998ecf8427e |
| container_format | bare |
| created_at | 2018-10-30T13:32:25Z |
| disk_format | raw |
| file | /v2/images/8fa5a8c6-150b-49c0-88f0-b6a6fa8849b0/file |
| id | 8fa5a8c6-150b-49c0-88f0-b6a6fa8849b0 |
| min_disk | 1 |
| min_ram | 0 |
| name | rhel-svc |
| owner | bf46fb095af344739bf78cdbba7df022 |
| properties | architecture='ppc64', bdm_v2='true', block_device_mapping='[{"guest_format":null,"boot_index":0,"no_device":null,"image_id":null,"volume_id":"5029cb07-3869-4bf5-8f05-5d4dda91bda1","disk_bus":null,"volume_size":null,"source_type":"volume","device_type":"disk","snapshot_id":null,"destination_type":"volume","delete_on_termination":true}]', endianness='big-endian', hypervisor_type='phyp', os_distro='rhel', root_device_name='/dev/sda' |
| protected | False |
| schema | /v2/schemas/image |
| size | 0 |
| status | active |
| tags | |
| updated_at | 2018-10-30T13:32:26Z |
| virtual_size | None |
| visibility | private |

So Image rhel-svc is currently belong to project ibm-default
[root@ip9-114-192-143 ~]# openstack project list
+----------------------------------+-----------------+
| ID | Name |
+----------------------------------+-----------------+
| 2546035b8188472aa8a0ebf9c27acdb8 | cinder-internal |
| 2f53abb621194ac09849dd5b09aa59e0 | chhavi |
| a1968f4e651d444fb13b9f13dbf00137 | service |
| b33fb44f96f64d84a0b73e39b39e9e31 | chshared |
| b7633f4048304bb6a0460468413766c1 | admin |
| b90df91061e44d8ab7fbf3deb1ba2b3b | prodpvc |
| bf46fb095af344739bf78cdbba7df022 | ibm-default |
| cd25a7adcb884aeca1eff25efd0204d3 | powervm |
+----------------------------------+-----------------+
[root@ip9-114-192-143 ~]#

[root@ip9-114-192-143 ~]# openstack image set rhel-svc --shared
[root@ip9-114-192-143 ~]#

Sharing with Project prodpvc
[root@ip9-114-192-143 ~]# openstack image add project rhel-svc b90df91061e44d8ab7fbf3deb1ba2b3b
+------------+--------------------------------------+
| Field | Value |
+------------+--------------------------------------+
| created_at | 2018-10-30T16:56:49Z |
| image_id | 8fa5a8c6-150b-49c0-88f0-b6a6fa8849b0 |
| member_id | b90df91061e44d8ab7fbf3deb1ba2b3b |
| schema | /v2/schemas/member |
| status | pending |
| updated_at | 2018-10-30T16:56:49Z |
+------------+--------------------------------------+
[root@ip9-114-192-143 ~]#

On consumer accepting the project
[bob@ip9-114-192-143 ~]$ openstack image set --accept --project b90df91061e44d8ab7fbf3deb1ba2b3b rhel-svc
[bob@ip9-114-192-143 ~]$

Setting the owner_id for the consumer project id
[bob@ip9-114-192-143 ~]$ openstack image show rhel-svc | grep owner
| owner | b90df91061e44d8ab7fbf3deb1ba2b3b |
[bob@ip9-114-192-143 ~]$

Openstack stable/queens

Revision history for this message
Brian Rosmaita (brian-rosmaita) wrote :

This is not a Glance bug. Possibly an openstackclient bug.

Changed in glance:
status: New → Invalid
Revision history for this message
Brian Rosmaita (brian-rosmaita) wrote :
Download full text (7.2 KiB)

I cannot reproduce this problem using normal user credentials. I can get something like this to happen using admin credentials, but it's possible that that is correct behavior.

Here's the setup to get in the situation Chhavi describes:

As the 'demo' user:

demo! glance image-create --container-format bare --disk-format qcow2 --name ShareTest
+------------------+--------------------------------------+
| Property | Value |
+------------------+--------------------------------------+
| checksum | None |
| container_format | bare |
| created_at | 2018-10-30T18:36:24Z |
| disk_format | qcow2 |
| id | 87208f0f-e484-4872-8ad5-9c94ba307d5b |
| min_disk | 0 |
| min_ram | 0 |
| name | ShareTest |
| os_hash_algo | None |
| os_hash_value | None |
| os_hidden | False |
| owner | 4d0255bb8ac04dcf9fc0f53126c88cde |
| protected | False |
| size | None |
| status | queued |
| tags | [] |
| updated_at | 2018-10-30T18:36:24Z |
| virtual_size | Not available |
| visibility | shared |
+------------------+--------------------------------------+
demo! glance image-upload --file /opt/stack/data/an_image 87208f0f-e484-4872-8ad5-9c94ba307d5b

# Share image with alt_demo project
demo! glance member-create 87208f0f-e484-4872-8ad5-9c94ba307d5b 11a13bbd46e34419b07bc4e42929285c
+--------------------------------------+----------------------------------+---------+
| Image ID | Member ID | Status |
+--------------------------------------+----------------------------------+---------+
| 87208f0f-e484-4872-8ad5-9c94ba307d5b | 11a13bbd46e34419b07bc4e42929285c | pending |
+--------------------------------------+----------------------------------+---------+

OK, now we go ahead and use openstackclient to change the status to 'accepted'.
This is done by the admin user. Call should fail otherwise (though I didn't check all permutations).

call being made: openstack image set --accept --project 11a13bbd46e34419b07bc4e42929285c ShareTest

When this call is made by an admin, should change the member-status to 'accepted' for the specified project
(Full output at http://paste.openstack.org/show/733660/ -- I removed auth and schema calls)

admin! openstack --debug image set --accept --project 11a13bbd46e34419b07bc4e42929285c ShareTest
START with options: [u'--debug', u'image', u'set', u'--accept', u'--project', u'11a13bbd46e34419b07bc4e42929285c', u'ShareTest']
options: Namespace(... project_domain_id='default', project_name='admin', user_domain_id='default', u...

Read more...

Revision history for this message
Brian Rosmaita (brian-rosmaita) wrote :

This could be a openstackclient bug. The point of this call:

openstack image set --accept --project 11a13bbd46e34419b07bc4e42929285c ShareTest

seems to be to allow an admin to change the member status of an image member, which is a useful thing to do. But the current implementation has the side effect of also changing the image owner.

Info:
OSC version: openstack 3.16.1
I did all the above in an S-1 devstack.

Revision history for this message
Brian Rosmaita (brian-rosmaita) wrote :

python-openstackclient tracks bugs in Storyboard. I filed a story for this:
https://storyboard.openstack.org/#!/story/2004214

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.