Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

glanceclient.exc.HTTPNotFound: The resource could not be found. (HTTP 404)

when add the smallest image for user demo , got error

[root@localhost martin(keystone_demo)]# python
Python 2.7.5 (default, Nov 20 2015, 02:00:19) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from glanceclient import client
>>> token = '5fd4ad2d0a7b4699'
>>> endpoint = 'http://192.168.157.131:5000/v2.0'
>>> glance = client.Client(token=token, endpoint=endpoint)
>>> image = glance.images.create(name="demo1quick")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/glanceclient/v2/images.py", line 228, in create
    image = self.model()
  File "/usr/lib/python2.7/site-packages/glanceclient/common/utils.py", line 447, in _memoized_property
    setattr(self, attr_name, fn(self))
  File "/usr/lib/python2.7/site-packages/glanceclient/v2/images.py", line 41, in model
    schema = self.schema_client.get('image')
  File "/usr/lib/python2.7/site-packages/glanceclient/v2/schemas.py", line 125, in get
    _, raw_schema = self.http_client.get(uri)
  File "/usr/lib/python2.7/site-packages/glanceclient/common/http.py", line 280, in get
    return self._request('GET', url, **kwargs)
  File "/usr/lib/python2.7/site-packages/glanceclient/common/http.py", line 272, in _request
    resp, body_iter = self._handle_response(resp)
  File "/usr/lib/python2.7/site-packages/glanceclient/common/http.py", line 93, in _handle_response
    raise exc.from_response(resp, resp.content)
glanceclient.exc.HTTPNotFound: The resource could not be found. (HTTP 404)
>>> print image.status
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'image' is not defined


from glanceclient import client
token = '5fd4ad2d0a7b4699'
endpoint = 'http://192.168.157.131:5000/v2.0'
glance = client.Client(token=token, endpoint=endpoint)
image = glance.images.create(name="demo1quick")
print image.status
image.update(data=open('http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img', 'rb'))
print image.status