Setting v2 to true and v1 to false causes HTTPMultipleChoice error

Bug #1743815 reported by James Bagwell
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Glance
Invalid
Undecided
Unassigned

Bug Description

I have a question. When I have:
glance::api::enable_v1_api: false
glance::api::enable_v2_api: true

I get error:
HTTPMultipleChoices (HTTP 300) Requested version of OpenStack Images API is not available.

stack_status | CREATE_FAILED
stack_status_reason | Resource CREATE failed: HTTPMultipleChoices: resources.image_src: HTTPMultipleChoices (HTTP 300) Requested version of OpenStack Images API is not available.
parameters | OS::project_id: 2713f28e0d0e481da6b43ee57b6e01a5
| OS::stack_id: c4954b03-8979-410d-b1b3-fc97fd50da7e
| OS::stack_name: blah
|
outputs | []

The following link suggests heat still uses v1 - http://lists.openstack.org/pipermail/openstack-operators/2017-March/013081.html

When I change it to:
glance::api::enable_v1_api: true
glance::api::enable_v2_api: true

I get the error:
500 Internal Server Error: The server has either erred or is incapable of performing the requested operation. (HTTP 500)

We see this in the glance-api.log shortly after:
Constructed URL: http://0.0.0.0:9191/images/detail?sort_key=name&sort_
dir=asc&limit=20 _construct_url /usr/lib/python2.7/site-packages/glance/common/client.py:402

9191 is the port for the registry and not the api. The service is obviously disabled / not running per this pull request. How can that be?

create_image.yml : https://pastebin.com/dn1wx6zn
stack trace: https://pastebin.com/WssiXWzz

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

About the 300: with v1 not enabled, any requests to v1 will return a 300 response. I don't know exactly what heat is doing under the hood, but if heat is trying to use v1 to make that create image request, you should see this in the glance-api log:

Jan 17 13:01:55 br-virtual-machine <email address hidden>[10751]: DEBUG glance.api.middleware.version_negotiation [-] Determining version of request: POST /v1/images Accept: */* {{(pid=10753) process_request /opt/stack/glance/glance/api/middleware/version_negotiation.py:45}}
Jan 17 13:01:55 br-virtual-machine <email address hidden>[10751]: DEBUG glance.api.middleware.version_negotiation [-] Using url versioning {{(pid=10753) process_request /opt/stack/glance/glance/api/middleware/version_negotiation.py:57}}
Jan 17 13:01:55 br-virtual-machine <email address hidden>[10751]: DEBUG glance.api.middleware.version_negotiation [-] Unknown version. Returning version choices. {{(pid=10753) process_request /opt/stack/glance/glance/api/middleware/version_negotiation.py:64}}
Jan 17 13:01:55 br-virtual-machine <email address hidden>[10751]: [pid: 10753|app: 0|req: 2/3] 127.0.0.1 () {40 vars in 770 bytes} [Wed Jan 17 13:01:55 2018] POST /v1/images => generated 678 bytes in 1 msecs (HTTP/1.1 300) 3 headers in 105 bytes (1 switches on core 0)

... and I just realized that these are all DEBUG level messages, so whether you'll see them or not depends on how the glance log levels are set.

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

What I *think* is going on with the 500 is that the Images v2 API does not require the registry (and in fact, the registry is deprecated in Queens, so even though you *can* use it with v2, you should not do so in any new installations). So if at installation time, only v2 is installed, it's possible that the glance registry service is *not* being installed. If you then change the API settings to enable the v1 API, if you make a call to the v1 API, Glance will try to contact the registry (because that is the only way v1 can communicate with the database) by constructing a URL like the one you found in the log. But if the registry isn't running, you'll ultimately get a 500 (which is the correct error, as it's a server-side problem due to configuration).

Hopefully this will give you enough info to troubleshoot further with someone more knowledgeable about Heat.

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

From what I can tell, Glance is behaving correctly. This may be a heat bug or heat misconfiguration issue. Feel free to re-open if this requires more discussion.

Changed in glance:
status: New → Invalid
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.