location-add return error when add new location to 'queued' image

Bug #1493026 reported by wangxiyuan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Opinion
Undecided
Kairat Kushaev
Glance Client
Fix Released
Undecided
Kairat Kushaev

Bug Description

Reproduce:

1. create a new image:
glance image-create --disk-format qcow2 --container-format bare --name test

suppose the image'id is 11111

2.add location to the image:

glance location-add 11111 --url xxxx

Result : the client raise an error:'The administrator has disabled API access to image locations'.

3.set show_multiple_locations = True in glance-api.conf. Then take step 1,2. It works now.

But when use REST API to reproduce it, No matter show_multiple_locations is False or True, it runs both well and the image's status will be changed into 'active'.

So there is one thing to discuess: Is it need to check the location in glance-client(show_multiple_locations)? Or Is it need to add the check like glance-client does in Glance server on the contrary?

wangxiyuan (wangxiyuan)
Changed in python-glanceclient:
assignee: nobody → wangxiyuan (wangxiyuan)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-glanceclient (master)

Fix proposed to branch: master
Review: https://review.openstack.org/220969

Changed in python-glanceclient:
status: New → In Progress
wangxiyuan (wangxiyuan)
description: updated
wangxiyuan (wangxiyuan)
description: updated
affects: python-glanceclient → glance
Changed in glance:
status: In Progress → Invalid
status: Invalid → In Progress
Revision history for this message
wangxiyuan (wangxiyuan) wrote :

don't have any good way to solve it now. need discussion.

Changed in glance:
status: In Progress → Opinion
assignee: wangxiyuan (wangxiyuan) → nobody
Revision history for this message
Niall Bunting (niall-bunting) wrote :

I changed the config file to set show_multiple_locations = true. Then if you do an image show the user is shown with a location. This then allows the user to do `glance location-add imageid --url url` which then seems to not come across this error.

Revision history for this message
wangxiyuan (wangxiyuan) wrote :

@Niall , yes, that config opiton did it. but I wonder whether it's the right way to do so. Show Location is a dangerous thing in my opinion. If we just want to add location, is it too open ?

Revision history for this message
Kairat Kushaev (kkushaev) wrote :

I faced some complains fro Heat guys about it.
So starting to analyze it.

Changed in glance:
assignee: nobody → Kairat Kushaev (kkushaev)
wangxiyuan (wangxiyuan)
description: updated
Revision history for this message
wangxiyuan (wangxiyuan) wrote :

Hi, Kairat, How is this bug goes now? As I knowm, Heat has met some problem about it as well. Or maybe we could have a discuession on the next weekly meeting?

description: updated
Revision history for this message
huangtianhua (huangtianhua) wrote :

I am working for migrate to use glance v2 in heat: https://review.openstack.org/#/c/240450
But seems it is impossible now for heat to add locations to image by default if using glanceclient v2. Heat requires user to specify 'location' in template for image resource when using glance v1, so I thought maybe heat should to create an empty image without 'location' parameter(glance v2 doesn't support), then to add location for the empty image, it's the correct way to compatible with old template for heat, but the constraint in glanceclient v2 prevents heat to do this. So I suggest to remove the constraint from glanceclient v2(the glance server supports to add location even if CONF.show_multiple_locations=False).

Revision history for this message
Niall Bunting (niall-bunting) wrote :

This is where the sever decides to not send the location list: https://github.com/openstack/glance/blob/master/glance/api/v2/images.py#L731-L739 Maybe this needs to change?

Revision history for this message
Niall Bunting (niall-bunting) wrote :

If we just remove that if statement, then the client will always be able send the location data?

Revision history for this message
Niall Bunting (niall-bunting) wrote :

Should we even allow locations to be set when the value is false? Or are there other options to control the granularity of locations and its data?

Revision history for this message
huangtianhua (huangtianhua) wrote :

What's the progress?

Revision history for this message
Kairat Kushaev (kkushaev) wrote :

I will try to propose the patch at the end of the week to glance client.
Let's see what the other folks will say.
A lot of Glance cores are on vacation now so I wouldn't expect to have this reviewed on this week.

Changed in python-glanceclient:
assignee: nobody → Kairat Kushaev (kkushaev)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: master
Review: https://review.openstack.org/242535

Changed in python-glanceclient:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-glanceclient (master)

Reviewed: https://review.openstack.org/242535
Committed: https://git.openstack.org/cgit/openstack/python-glanceclient/commit/?id=cea67763c9f8037f47844e3e057166d6874d801d
Submitter: Jenkins
Branch: master

commit cea67763c9f8037f47844e3e057166d6874d801d
Author: kairat_kushaev <email address hidden>
Date: Fri Nov 6 18:16:30 2015 +0300

    Remove location check from V2 client

    Glance client has a custom check that generates exception if
    location has not been returned by image-get request.
    This check should on server side and it should be managed by
    policy rules when do location-add action.
    That also allows to increase possibility of migrating Heat
    to v2[1].

    NOTE: After this patch, we'll raise a HTTPBadRequest from
    server side instead of HTTPConflict when a user adds a
    duplicate location.

    [1]: https://review.openstack.org/#/c/240450/

    Co-Authored-By: wangxiyuan <email address hidden>

    Change-Id: I778ad2a97805b4d85eb0430c603c27a0a1c148e0
    Closes-bug: #1493026

Changed in python-glanceclient:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-glanceclient (stable/liberty)

Fix proposed to branch: stable/liberty
Review: https://review.openstack.org/295532

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on python-glanceclient (stable/liberty)

Change abandoned by Sean Dague (<email address hidden>) on branch: stable/liberty
Review: https://review.openstack.org/295532
Reason: liberty branch is closed

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.