/v2 route doesn't exist

Bug #1632742 reported by Matt Riedemann
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Won't Fix
Undecided
Unassigned

Bug Description

Looking at the api-ref docs, I'm able to list versions of the image API available in a cloud (I'm using a devstack created from master as of last week):

http://developer.openstack.org/api-ref/image/versions/index.html?expanded=id1-detail#id1

stack@osc:/opt/stack/glance$ git log -1
commit 9bd264cd034f996852372ae0ca988bd67b98cf9a
Merge: 2de3caf ce6cb2d
Author: Jenkins <email address hidden>
Date: Tue Oct 4 02:28:10 2016 +0000

    Merge "[api-ref] configure LogABug feature"
stack@osc:/opt/stack/glance$

I'm able to list versions for the image endpoint:

stack@osc:/opt/stack/glance$ curl -s -H "X-Auth-Token: $OS_TOKEN" http://9.5.127.82:9292 | json_pp
{
   "versions" : [
      {
         "id" : "v2.4",
         "status" : "CURRENT",
         "links" : [
            {
               "rel" : "self",
               "href" : "http://9.5.127.82:9292/v2/"
            }
         ]
      },
      {
         "links" : [
            {
               "rel" : "self",
               "href" : "http://9.5.127.82:9292/v2/"
            }
         ],
         "id" : "v2.3",
         "status" : "SUPPORTED"
      },
      {
         "links" : [
            {
               "rel" : "self",
               "href" : "http://9.5.127.82:9292/v2/"
            }
         ],
         "status" : "SUPPORTED",
         "id" : "v2.2"
      },
      {
         "id" : "v2.1",
         "status" : "SUPPORTED",
         "links" : [
            {
               "rel" : "self",
               "href" : "http://9.5.127.82:9292/v2/"
            }
         ]
      },
      {
         "status" : "SUPPORTED",
         "id" : "v2.0",
         "links" : [
            {
               "href" : "http://9.5.127.82:9292/v2/",
               "rel" : "self"
            }
         ]
      },
      {
         "links" : [
            {
               "href" : "http://9.5.127.82:9292/v1/",
               "rel" : "self"
            }
         ],
         "status" : "DEPRECATED",
         "id" : "v1.1"
      },
      {
         "links" : [
            {
               "rel" : "self",
               "href" : "http://9.5.127.82:9292/v1/"
            }
         ],
         "id" : "v1.0",
         "status" : "DEPRECATED"
      }
   ]
}
stack@osc:/opt/stack/glance$

I'm able to list the v1 route which is just a list of images:

stack@osc:/opt/stack/glance$ curl -s -H "X-Auth-Token: $OS_TOKEN" http://9.5.127.82:9292/v1/ | json_pp {
   "images" : [
      {
         "size" : 25165824,
         "name" : "cirros-0.3.4-x86_64-uec",
         "id" : "c8af19ff-cebc-4112-a237-78dcd19e588c",
         "disk_format" : "ami",
         "checksum" : "eb9139e4942121f22bbc2afc0400b2a4",
         "container_format" : "ami"
      },
      {
         "disk_format" : "ari",
         "container_format" : "ari",
         "checksum" : "be575a2b939972276ef675752936977f",
         "size" : 3740163,
         "name" : "cirros-0.3.4-x86_64-uec-ramdisk",
         "id" : "ff195fc4-c039-43b5-acca-501aba68aba2"
      },
      {
         "size" : 4979632,
         "name" : "cirros-0.3.4-x86_64-uec-kernel",
         "id" : "08463073-3460-4b5f-92cc-ade974936e96",
         "disk_format" : "aki",
         "container_format" : "aki",
         "checksum" : "8a40c862b5735975d82605c1dd395796"
      }
   ]
}

But I'm not able to list the v2 route:

stack@osc:/opt/stack/glance$ curl -s -H "X-Auth-Token: $OS_TOKEN" http://9.5.127.82:9292/v2/
404 Not Found

The resource could not be found.

   stack@osc:/opt/stack/glance$

Revision history for this message
Matt Riedemann (mriedem) wrote :

Also, the v1 route lists images, is that by design? I was expecting it to provide details on the v1 API version.

tags: added: api documentation
Revision history for this message
Sean Dague (sdague) wrote :

In my reading of the api-ref document, there is nothing stating that this is a valid url. I actually think the 404 is correct

Changed in glance:
status: New → Incomplete
Revision history for this message
Brian Rosmaita (brian-rosmaita) wrote :

The image-list response for GET v1/ is by design, though it was designed before my time, so I can't tell you what the reasoning was behind it. We'll have to keep it like this.

Looking into the GET v2/ situation now.

Revision history for this message
Matt Riedemann (mriedem) wrote :

@Sean, then the root /versions response shouldn't provide links to a busted URL should they? Because they do:

{
         "status" : "SUPPORTED",
         "id" : "v2.0",
         "links" : [
            {
               "href" : "http://9.5.127.82:9292/v2/",
               "rel" : "self"
            }
         ]
      },

Revision history for this message
Matt Riedemann (mriedem) wrote :

Also just doing /v2 without the trailing slash doesn't do anything:

stack@osc:/opt/stack/glance$ curl -G -H "X-Auth-Token: $OS_TOKEN" http://9.5.127.82:9292/v2
stack@osc:/opt/stack/glance$

2016-10-12 15:40:07.551 INFO eventlet.wsgi.server [req-806a6004-9d72-4386-b01b-c8db5806a9dd 95802c8f3a424b8d83b898ced6b2bb31 f6e20cc9f34d4c7fafb56e81905df44d] 9.5.127.82 - - [12/Oct/2016 15:40:07] "GET /v2 HTTP/1.1" 302 222 0.047123

There should be a redirect location in the response, but there isn't one.

Revision history for this message
Matt Riedemann (mriedem) wrote :
Revision history for this message
Matt Riedemann (mriedem) wrote :

stack@osc:~$ curl -G -i -H "X-Auth-Token: $OS_TOKEN" http://9.5.127.82:9292/v2
HTTP/1.1 302 Found
Content-Type: text/plain; charset=utf8
Location: http://9.5.127.82:9292/v2/
X-Openstack-Request-Id: req-eb53a8f9-a38c-4188-82fb-a8a3d747f395
Content-Length: 0
Date: Wed, 12 Oct 2016 15:51:00 GMT

So that returns a location in the response to the /v2/ route that doesn't exist and will give you a 404. :)

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

Here's what we currently see on the v2 endpoint, courtesy of Matt:

stack@osc:~$ curl -G -i -H "X-Auth-Token: $OS_TOKEN" http://9.5.127.82:9292/v2/
HTTP/1.1 404 Not Found
Content-Length: 52
Content-Type: text/plain; charset=UTF-8
X-Openstack-Request-Id: req-76d77d29-9278-4530-b2a1-c44e54cabc32
Date: Wed, 12 Oct 2016 15:50:06 GMT

stack@osc:~$ curl -G -i -H "X-Auth-Token: $OS_TOKEN" http://9.5.127.82:9292/v2
HTTP/1.1 302 Found
Content-Type: text/plain; charset=utf8
Location: http://9.5.127.82:9292/v2/
X-Openstack-Request-Id: req-eb53a8f9-a38c-4188-82fb-a8a3d747f395
Content-Length: 0
Date: Wed, 12 Oct 2016 15:51:00 GMT

So GET v2 gives you a redirect to GET v2/ ... and GET v2/ gives you a 404.

Matt's point is that since the v2/ shows up in the /versions response (see above), you'd expect *something* to be there. Most projects give a version list there.

We need to decide what to do for Glance and document it.

Changed in glance:
status: Incomplete → Triaged
Changed in glance:
assignee: nobody → Brian Rosmaita (brian-rosmaita)
Revision history for this message
Brian Rosmaita (brian-rosmaita) wrote :

Here's a summary of the requests/responses

suppose your glance endpoint is g.os.org:9292

(token not required for these)
GET g.os.org:9292 => 300 (Multiple Choices) + "versions" response
GET g.os.org:9292/ => 300 + "versions" response
GET g.os.org:9292/versions => 200 + "versions" response
GET g.os.org:9292/versions/ => 200 + "versions" response

(token required for the following)
GET g.os.org:9292/v1 => 302 (Found) + Location: http://g.os.org:9292/v1/ + no content
GET g.os.org:9292/v1/ => 200 + image-list response for authenticated user
GET g.os.org:9292/v2 => 302 + Location: http://g.os.org:9292/v2/ + no content
GET g.os.org:9292/v2/ => 404

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

I must've had this sitting open for a while and completely missed Sean's update.

We discussed this at the glance meeting today and decided to agree with Sean's position, namely that a 404 is appropriate.

It could make sense to have the versions returned, or it could make sense to have a JSON-home type document returned. So we don't want to be precipitate in deciding what (if anything) to return.

Changed in glance:
status: Triaged → Won't Fix
assignee: Brian Rosmaita (brian-rosmaita) → nobody
Revision history for this message
Matt Riedemann (mriedem) wrote :

I'm fine with it not being there, but then why do we even have the links in the root version discovery list? e.g.

        {
            "id": "v2.0",
            "links": [
                {
                    "href": "http://glance.openstack.example.org/v2/",
                    "rel": "self"
                }
            ],
            "status": "SUPPORTED"
        },

If I try to follow that self link it's going to fail - then why have the link in there at all? This at least seems confusing from a version discovery standpoint, and could be made clear in the docs.

Revision history for this message
Matt Riedemann (mriedem) wrote :

Another example of the docs saying that a self link refers back to itself here:

http://developer.openstack.org/api-guide/compute/links_and_references.html

And links are used for conveniently showing you where to go - but it shouldn't show you to go somewhere that doesn't exist. It'd be better to not even have the link IMO.

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.