image id is checked after uploading image

Bug #1674886 reported by the-bling
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance Client
Triaged
Wishlist
Unassigned

Bug Description

version: mitaka

When uploading an image, the ID is checked after the image is uploaded.
This is not much of an issue for small images like cirros but for larger images like rhel, it takes up lot of network.

Ideally, the ID of the image should be checked before the upload takes place.

Log below:--

glance --debug image-upload --file ubuntu-14.04-desktop-amd64.iso --progress 4a525188-2e6f-4e49-88cd-311ca215535y
[=============================>] 100%
Request returned failure status 404.
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/glanceclient/shell.py", line 595, in main
    args.func(client, args)
  File "/usr/lib/python2.7/site-packages/glanceclient/v2/shell.py", line 322, in do_image_upload
    gc.images.upload(args.id, image_data, args.size)
  File "/usr/lib/python2.7/site-packages/glanceclient/v2/images.py", line 217, in upload
    self.http_client.put(url, headers=hdrs, data=body)
  File "/usr/lib/python2.7/site-packages/keystoneclient/adapter.py", line 185, in put
    return self.request(url, 'PUT', **kwargs)
  File "/usr/lib/python2.7/site-packages/glanceclient/common/http.py", line 332, in request
    return self._handle_response(resp)
  File "/usr/lib/python2.7/site-packages/glanceclient/common/http.py", line 83, in _handle_response
    raise exc.from_response(resp, resp.content)
HTTPNotFound: 404 Not Found: No image found with ID 4a525188-2e6f-4e49-88cd-311ca215535y (HTTP 404)
404 Not Found: No image found with ID 4a525188-2e6f-4e49-88cd-311ca215535y (HTTP 404)

Revision history for this message
Feilong Wang (flwang) wrote :

It's not a glance server problem. And I don't think it's a bug but an enhancement for the client.

affects: glance → python-glanceclient
Changed in python-glanceclient:
importance: Undecided → Wishlist
assignee: nobody → Fei Long Wang (flwang)
Revision history for this message
Prerna Dembla (prerna.dembla) wrote :

Operation image upload is performed in below three steps:
STEP 1) Chunking of the image : The large size image file is divided into smaller size chunks.
STEP 2) Validation of image ID. If image ID is valid then proceed to Step 3 else EXIT.
STEP 3) Uploading of the chunks to the empty container.

If an invalid image-id is provided in image upload operation, then unwanted CPU effort get waste in chunking of image and then Error response "No image found with ID <image-id>"is returned.
Ideally, the validity of the <image-id> should be checked first to prevent further chunking of data.

Changed in python-glanceclient:
assignee: Feilong Wang (flwang) → nobody
status: New → Triaged
Changed in python-glanceclient:
assignee: nobody → Deepak Mourya (mourya007)
Changed in python-glanceclient:
assignee: Deepak Mourya (mourya007) → nobody
Changed in python-glanceclient:
assignee: nobody → HanGuangyu (hanguangyu)
Changed in python-glanceclient:
assignee: HanGuangyu (hanguangyu) → nobody
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.