Glance Client tool - getting 'Bad file descriptor' when calling GET image JSON schema

Bug #1222369 reported by Maty Grosz
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
New
Undecided
Unassigned

Bug Description

Hi,

When I am running Glance Client tool against glance service using the following command:

> glance --debug --os-image-api-version 2 image-list

I get the followng output:

curl -i -X GET -H 'X-Auth-Token: rO0ABXc4ACAyYzlkYTk4ZDQwZGVmNWU2MDE0MGZjZDI0OThiMzk3MQAGbWdyb3N6AAQzMDQ3AAABQP0JOAs' -H 'Content-Type: application/json' -H 'User-Agent: python-glanceclient' -k https://cb.alucloud.local/al-openstack/v2/schemas/image
(9, 'Bad file descriptor')

--------------------------------------------------------------------------------------------------------------------------------------------

*BUT* when I am running just the exact curl command you see in the debug log

> curl -i -X GET -H 'X-Auth-Token: rO0ABXc4ACAyYzlkYTk4ZDQwZGVmNWU2MDE0MGZjZDI0OThiMzk3MQAGbWdyb3N6AAQzMDQ3AAABQP0JOAs' -H 'Content-Type: application/json' -H 'User-Agent: python-glanceclient' -k https://cb.alucloud.local/al-openstack/v2/schemas/image

I get what am I expecting to get - the JSON schema:

HTTP/1.1 200 OK
Date: Sun, 08 Sep 2013 09:51:04 GMT
Content-Type: application/json
Content-Length: 4958
Connection: close

{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"visibility":{"type":"string","enum":["public","private"]},"file":{"type":"string"},"status":{"type":"string"},"minDisk":{"type":"integer"},"minRam":{"type":"integer"},"progress":{"type":"integer"},"userId":{"type":"string"},"metadata":{"type":"object"},"self":{"type":"string"},"size":{"type":"number"},"schema":{"type":"string"},"checksum":{"type":"string"},"customerId":{"type":"string"},"updated_at":{"type":"string"},"created_at":{"type":"string"},"container_format":{"type":"string","enum":["ovf","bare","aki","ari","ami"]},"disk_format":{"type":"string","enum":["raw","vhd","vmdk","vdi","iso","qcow2","aki","ari","ami"]},"name":"image"}

Revision history for this message
Mark Washenberger (markwash) wrote :

Can you try a curl command similar to the above but changing "v2/schemas/image" to "v2/images", please?

Revision history for this message
Maty Grosz (maty-grosz) wrote :

I have upgraded the python-glanceclient to v0.11.0.
Now, I get a whole new different behavior... I get 404 - Item not found, and the reason is as followes:

In file glanceclient/common/http.py, line #192:

---------------------------------------------------------
if self.endpoint_path:
        url = urlparse.urljoin(self.endpoint_path, url)
conn_url = urlparse.urlsplit(url).geturl()
---------------------------------------------------------

instead of calling urlparse.urljoin, just replace it with
        url = self.endpoint_path + url

And everything is happy!

I, in my application, expose OpenStack Image APIs (v2), using the following URI structure:

http://<host>:<port>/some/path/prefix/v2/schemas/image

If I run glance client image-list command using the source code, with the bug -
> the value of self.endpoint_path is /some/path/prefix
> the value of url is /v2/schemas/image,
*but*
> the value of urlparse.urljoin(self.endpoint_path, url) is *JUST* /v2/schemas/image...

and thus, the value of conn_url is http://<host>:<port>/v2/schemas/image - which, of course, I don't listen to and thus get 404.

Need a fix for that.

Thanks,

Maty.

Revision history for this message
Zhi Yan Liu (lzy-dev) wrote :

It's a known defect in glanceclient https://bugs.launchpad.net/python-glanceclient/+bug/1230032 , and it is fixinghttps://review.openstack.org/#/c/48285/ .

Thanks for you report.

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.