Bug 1070258 - image-create does not output useful error if file not found
Summary: image-create does not output useful error if file not found
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-glance
Version: 4.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: 5.0 (RHEL 7)
Assignee: Flavio Percoco
QA Contact: Tzach Shefi
URL:
Whiteboard:
Depends On: 1022900
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-02-26 13:50 UTC by Jonathan gershater
Modified: 2017-08-28 22:59 UTC (History)
6 users (show)

Fixed In Version: openstack-glance-2014.1-4.el7ost
Doc Type: Bug Fix
Doc Text:
Previously, the 'glance image-create' operation would report that it had completed successfully under certain conditions even when it had failed. This was caused by the logic used to create images, whereby it was possible to create images that referenced a URI even when that URI was invalid. This update revises this logic so that it is no longer possible to create images with an invalid URI and so that an error message is provided on failure.
Clone Of:
Environment:
Last Closed: 2014-07-08 15:32:17 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Glance api.log (7.18 KB, text/plain)
2014-06-12 08:21 UTC, Tzach Shefi
no flags Details


Links
System ID Private Priority Status Summary Last Updated
OpenStack gerrit 86546 0 None MERGED Prevent creation of http images with invalid URIs 2020-08-20 13:28:38 UTC
Red Hat Product Errata RHEA-2014:0851 0 normal SHIPPED_LIVE Red Hat Enterprise Linux OpenStack Platform Enhancement - Image Service 2014-07-08 19:22:51 UTC

Description Jonathan gershater 2014-02-26 13:50:06 UTC
Description of problem:
I executed this command:

glance  image-create --name RHEL6.5 --disk-format=qcow2 --container-format=bare --is-public true --copy-from http://http://storage.lab.bos.redhat.com/rhel-guest-image-6.5-20140121.0.x86_64.qcow2

Message in console was ".... image queued"

When I execute "glance image-list" - its empty

Error in log /var/log/glance/api.log
 "Failed to configure store correctly: Store sheepdog could not be configured correctly. Reason: Error in store configuration: Unexpected error while running command." 

Actual problem is this file does not exist
"http://storage.lab.bos.redhat.com/rhel-guest-image-6.5-20140121.0.x86_64.qcow2"

So what "image-create" should have outputted at the command prompt was "file not found" or even a simple "http 404" and halted - instead of inaccurately 'queuing' the image and throwing an error in the api.log 

Version-Release number of selected component (if applicable):
RHEL-OSP4

How reproducible:
Do an "glance image-create" and use a bad URL

Comment 3 Tzach Shefi 2014-06-09 16:19:57 UTC
Checked on:
RHEL7 
openstack-glance-2014.1-2.el7ost.noarch

Using exact same image-upload command
On console -> status  | queued 
# glance image-list   -> empty list. 

What exactly am I supposed to get on console or api.log in such a case of bad URL?

Checking code (guessing) should get "The HTTP URL is invalid" 
# grep "The HTTP URL is invalid" -r /var/log/  returns nothing. 

Nor have I gotten such a notice on console. 

Thanks

Comment 8 Tzach Shefi 2014-06-12 08:20:31 UTC
Verified on:
rhel7 
python-glance-2014.1-4.el7ost.noarch
python-glanceclient-0.12.0-1.el7ost.noarch
openstack-glance-2014.1-4.el7ost.noarch
openstack-glance-doc-2014.1-4.el7ost.noarch

As expected uploading image from invalid URL, console -> "The HTTP URL is invalid" As well as notice on api.log


[root@dhcp160-207 glance(keystone_admin)]# glance  image-create --name RHEL6.5 --disk-format=qcow2 --container-format=bare --is-public true --copy-from http://http://storage.lab.bos.redhat.com/rhel-guest-image-6.5-20140121.0.x86_64.qcow2
Request returned failure status.
400 Bad Request
The HTTP URL is invalid.
    (HTTP 400)


Section from api.log debug=true

2014-06-12 11:15:57.197 5256 DEBUG routes.middleware [3b324204-f075-41bc-b3e7-61f61792c5b3 0d5ee85f3c4c4c18ad9e2e900998a6d3 00fbd2008f914e56b00fd3efe961bee8 - - -] Match dict: {'action': u'create', 'controller': <glance.common.wsgi.Resource object at 0x3c83350>} __call__ /usr/lib/python2.7/site-packages/routes/middleware.py:103
2014-06-12 11:15:57.324 5256 DEBUG glance.store.http [3b324204-f075-41bc-b3e7-61f61792c5b3 0d5ee85f3c4c4c18ad9e2e900998a6d3 00fbd2008f914e56b00fd3efe961bee8 - - -] The HTTP URL is invalid. get_size /usr/lib/python2.7/site-packages/glance/store/http.py:152
2014-06-12 11:15:57.325 5256 DEBUG glance.api.v1.images [3b324204-f075-41bc-b3e7-61f61792c5b3 0d5ee85f3c4c4c18ad9e2e900998a6d3 00fbd2008f914e56b00fd3efe961bee8 - - -] The HTTP URL is invalid. _get_size /usr/lib/python2.7/site-packages/glance/api/v1/images.py:679
2014-06-12 11:15:57.328 5256 INFO glance.wsgi.server [3b324204-f075-41bc-b3e7-61f61792c5b3 0d5ee85f3c4c4c18ad9e2e900998a6d3 00fbd2008f914e56b00fd3efe961bee8 - - -] 10.35.160.207 - - [12/Jun/2014 11:15:57] "POST /v1/images HTTP/1.1" 400 238 0.159937

Comment 9 Tzach Shefi 2014-06-12 08:21:01 UTC
Created attachment 908006 [details]
Glance api.log

Comment 12 errata-xmlrpc 2014-07-08 15:32:17 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHEA-2014-0851.html

Comment 13 Andrew Dahms 2017-08-28 22:59:37 UTC
Cancelling old needinfo request.


Note You need to log in before you can comment on or make changes to this bug.