Chunked transfer encoding is not being used
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Glance Client |
Fix Released
|
High
|
Stuart McLaren |
Bug Description
"Transfer-Encoding: chunked" isn't being used. This leads to problems when the size of the file/stream being uploaded is not known in advance (as may be the case when nova takes a snapshot for example).
This is demonstrated here using named pipes, which are shown to work for the old client but not the new cilent. A patch to use transfer encoding for uploads allows the named pipe example to work.
In the commands below 'glance' is the old glance client (circa Diablo), 'glance2'
is the latest python-
'Old client' image upload using named pipe:
Terminal 1:
$ mkfifo pipe
$ glance -A xxxx -U https:/
Terminal 2:
$ echo hi > pipe
Terminal 1 output:
Added new image with ID: 0931df72-
Verify image uploaded ok:
$ glance2 --os-image-url https:/
+------
| Property | Value |
+------
| checksum | 764efa883dda1e1
| container_format | bare |
| created_at | 2012-09-
| deleted | False |
| disk_format | raw |
| id | 0931df72-
| is_public | False |
| min_disk | 0 |
| min_ram | 0 |
| name | x1 |
| owner | 53648642643910 |
| protected | False |
| size | 3 |
| status | active |
| updated_at | 2012-09-
+------
$ glance2 --os-image-url https:/
hi
HTTP exchange:
POST /v1/images HTTP/1.1.
Host: x.x.x.x:9292.
Accept-Encoding: identity.
x-image-
x-image-
x-auth-token: xxxxx.
x-image-
x-image-
content-type: application/
x-image-
x-image-meta-name: x1.
Transfer-Encoding: chunked.
.
##
T x.x.x.x:44638 -> x.x.x.x:9292 [AP]
3.
hi
.
0.
.
HTTP/1.1 201 Created.
Content-Type: application/json.
Content-Length: 440.
Location: http://
Etag: 764efa883dda1e1
X-Openstack-
Date: Tue, 25 Sep 2012 13:03:37 GMT.
.
'New client' image upload using named pipe:
Terminal 1:
$ mkfifo pipe
$ glance2 --os-image-url https:/
Terminal 2:
$ echo hi > pipe
Terminal 1 output:
+------
| Property | Value |
+------
| checksum | None |
| container_format | bare |
| created_at | 2012-09-
| deleted | False |
| deleted_at | None |
| disk_format | raw |
| id | 180777a0-
| is_public | False |
| min_disk | 0 |
| min_ram | 0 |
| name | None |
| owner | 53648642643910 |
| protected | False |
| size | 0 |
| status | queued |
| updated_at | 2012-09-
+------
Verify image uploaded (fails):
$ glance2 --os-image-url https:/
Request returned failure status.
HTTPNotFound (HTTP 404)
HTTP exchange:
POST /v1/images HTTP/1.1.
Host: x.x.x.x:9292.
Accept-Encoding: identity.
x-image-
User-Agent: python-
x-image-
X-Auth-Token: xxxxx.
Content-Type: application/
x-image-
.
HTTP/1.1 201 Created.
Content-Type: application/json.
Content-Length: 410.
Location: http://
Etag: None.
X-Openstack-
Date: Tue, 25 Sep 2012 13:02:17 GMT.
.
Repeat with new client patched to enable chunked transfer encoding:
Terminal 1:
$ mkfifo pipe
$ glance2 --os-image-url https:/
Terminal 2:
$ echo hi > pipe
Terminal 1 output:
+------
| Property | Value |
+------
| checksum | 764efa883dda1e1
| container_format | bare |
| created_at | 2012-09-
| deleted | False |
| deleted_at | None |
| disk_format | raw |
| id | ed5f01ff-
| is_public | False |
| min_disk | 0 |
| min_ram | 0 |
| name | None |
| owner | 53648642643910 |
| protected | False |
| size | 3 |
| status | active |
| updated_at | 2012-09-
+------
Verify image uploaded (succeeds):
$ glance2 --os-image-url http://
hi
HTTP exchange:
POST /v1/images HTTP/1.1.
Host: x.x.x.x:9292.
Accept-Encoding: identity.
x-image-
User-Agent: python-
x-image-
X-Auth-Token: HPAuth_
Content-Type: application/
x-image-
Transfer-Encoding: chunked.
.
#
3.
hi
.
##
0.
.
##
HTTP/1.1 201 Created.
Content-Type: application/json.
Content-Length: 440.
Location: http://
Etag: 764efa883dda1e1
X-Openstack-
Date: Tue, 25 Sep 2012 13:23:22 GMT.
Changed in python-glanceclient: | |
assignee: | nobody → Stuart McLaren (stuart-mclaren) |
Changed in python-glanceclient: | |
importance: | Undecided → High |
milestone: | none → v0.6.0 |
Changed in python-glanceclient: | |
status: | Fix Committed → Fix Released |
Is this related to https:/ /bugs.launchpad .net/python- glanceclient/ +bug/1035250 ?