Cannot delete image with Swift backend

Asked by Édouard Thuleau on 2011-04-26

Hi,

I use Glance bzr124 on a ubuntu 10.04 LTS with a backend Swift 1.2.0.
I can upload and list files on the object store but when I tried to delete one, I've got this error :

$ glance delete 1

Delete image 1? [y/N] y
Traceback (most recent call last):
  File "/usr/bin/glance", line 605, in <module>
    result = command(options, args)
  File "/usr/bin/glance", line 327, in image_delete
    c.delete_image(image_id)
  File "/usr/lib/pymodules/python2.6/glance/client.py", line 289, in delete_image
    self.do_request("DELETE", "/images/%s" % image_id)
  File "/usr/lib/pymodules/python2.6/glance/client.py", line 161, in do_request
    raise Exception("Internal Server error: %s" % res.read())
Exception: Internal Server error: Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/eventlet/wsgi.py", line 336, in handle_one_response
    result = self.application(self.environ, start_response)
  File "/usr/lib/pymodules/python2.6/webob/dec.py", line 159, in __call__
    return resp(environ, start_response)
  File "/usr/lib/pymodules/python2.6/routes/middleware.py", line 131, in __call__
    response = self.app(environ, start_response)
  File "/usr/lib/pymodules/python2.6/webob/dec.py", line 159, in __call__
    return resp(environ, start_response)
  File "/usr/lib/pymodules/python2.6/webob/dec.py", line 147, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/pymodules/python2.6/webob/dec.py", line 208, in call_func
    return self.func(req, *args, **kwargs)
  File "/usr/lib/pymodules/python2.6/glance/common/wsgi.py", line 228, in __call__
    result = method(**arg_dict)
  File "/usr/lib/pymodules/python2.6/glance/server.py", line 456, in delete
    delete_from_backend(image['location'])
  File "/usr/lib/pymodules/python2.6/glance/store/__init__.py", line 94, in delete_from_backend
    return backend_class.delete(parsed_uri, **kwargs)
  File "/usr/lib/pymodules/python2.6/glance/store/swift.py", line 180, in delete
    swift_conn.delete_object(container, obj)
  File "/usr/lib/pymodules/python2.6/swift/common/client.py", line 839, in delete_object
    return self._retry(None, delete_object, container, obj)
  File "/usr/lib/pymodules/python2.6/swift/common/client.py", line 734, in _retry
    self.url, self.token = self.get_auth()
  File "/usr/lib/pymodules/python2.6/swift/common/client.py", line 722, in get_auth
    return get_auth(self.authurl, self.user, self.key, snet=self.snet)
  File "/usr/lib/pymodules/python2.6/swift/common/client.py", line 177, in get_auth
    parsed, conn = http_connection(url)
  File "/usr/lib/pymodules/python2.6/swift/common/client.py", line 153, in http_connection
    conn = HTTPSConnection(parsed.netloc)
  File "/usr/lib/python2.6/httplib.py", line 1101, in __init__
    HTTPConnection.__init__(self, host, port, strict, timeout)
  File "/usr/lib/python2.6/httplib.py", line 657, in __init__
    self._set_hostport(host, port)
  File "/usr/lib/python2.6/httplib.py", line 682, in _set_hostport
    raise InvalidURL("nonnumeric port: '%s'" % host[i+1:])
InvalidURL: nonnumeric port: ''

In the log file of glance (registery + API) :

2011-04-26 18:05:08 DEBUG [routes.middleware] Matched DELETE /images/1
2011-04-26 18:05:08 DEBUG [routes.middleware] Route path: '/images/:(id)', defaults: {'action': u'delete', 'controller': <glance.server.Controller object
at 0x1cd3310>}
2011-04-26 18:05:08 DEBUG [routes.middleware] Match dict: {'action': u'delete', 'controller': <glance.server.Controller object at 0x1cd3310>, 'id': u'1'}
2011-04-26 18:05:08 DEBUG [routes.middleware] Matched GET /images/1
2011-04-26 18:05:08 DEBUG [routes.middleware] Route path: '/images/:(id)', defaults: {'action': u'show', 'controller': <glance.registry.server.Controller
object at 0x220e510>}
2011-04-26 18:05:08 DEBUG [routes.middleware] Match dict: {'action': u'show', 'controller': <glance.registry.server.Controller object at 0x220e510>, 'id':
 u'1'}
2011-04-26 18:05:08 INFO [sqlalchemy.engine.base.Engine.0x...a2d0] SELECT images.created_at AS images_created_at, images.updated_at AS images_updated_at,
 images.deleted_at AS images_deleted_at, images.deleted AS images_deleted, images.id AS images_id, images.name AS images_name, images.disk_format AS images_d
isk_format, images.container_format AS images_container_format, images.size AS images_size, images.status AS images_status, images.is_public AS images_is_pub
lic, images.location AS images_location, images.checksum AS images_checksum, image_properties_1.created_at AS image_properties_1_created_at, image_properties
_1.updated_at AS image_properties_1_updated_at, image_properties_1.deleted_at AS image_properties_1_deleted_at, image_properties_1.deleted AS image_propertie
s_1_deleted, image_properties_1.id AS image_properties_1_id, image_properties_1.image_id AS image_properties_1_image_id, image_properties_1.name AS image_pro
perties_1_name, image_properties_1.value AS image_properties_1_value
FROM images LEFT OUTER JOIN image_properties AS image_properties_1 ON images.id = image_properties_1.image_id
WHERE images.deleted = %s AND images.id = %s
2011-04-26 18:05:08 INFO [sqlalchemy.engine.base.Engine.0x...a2d0] (False, '1')
2011-04-26 18:05:08 DEBUG [sqlalchemy.engine.base.Engine.0x...a2d0] Col ('images_created_at', 'images_updated_at', 'images_deleted_at', 'images_deleted',
'images_id', 'images_name', 'images_disk_format', 'images_container_format', 'images_size', 'images_status', 'images_is_public', 'images_location', 'images_c
hecksum', 'image_properties_1_created_at', 'image_properties_1_updated_at', 'image_properties_1_deleted_at', 'image_properties_1_deleted', 'image_properties_
1_id', 'image_properties_1_image_id', 'image_properties_1_name', 'image_properties_1_value')
2011-04-26 18:05:08 DEBUG [sqlalchemy.engine.base.Engine.0x...a2d0] Row (datetime.datetime(2011, 4, 26, 15, 59, 28), datetime.datetime(2011, 4, 26, 15, 59
, 29), None, 0, 1L, 'Test Swift', 'qcow2', 'bare', 6182L, 'active', 1, 'swift://glance:ethuleau:nah2eeBo@https://p-hs21-15-swift-proxy-1:11000/v1.0//glance/1
', 'f21ea10ef86385db52e39158d7052c58', None, None, None, None, None, None, None, None)
2011-04-26 18:05:08 DEBUG [eventlet.wsgi.server] Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/eventlet/wsgi.py", line 336, in handle_one_response
    result = self.application(self.environ, start_response)
  File "/usr/lib/pymodules/python2.6/webob/dec.py", line 159, in __call__
    return resp(environ, start_response)
  File "/usr/lib/pymodules/python2.6/routes/middleware.py", line 131, in __call__
    response = self.app(environ, start_response)
  File "/usr/lib/pymodules/python2.6/webob/dec.py", line 159, in __call__
    return resp(environ, start_response)
  File "/usr/lib/pymodules/python2.6/webob/dec.py", line 147, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/pymodules/python2.6/webob/dec.py", line 208, in call_func
    return self.func(req, *args, **kwargs)
  File "/usr/lib/pymodules/python2.6/glance/common/wsgi.py", line 228, in __call__
    result = method(**arg_dict)
  File "/usr/lib/pymodules/python2.6/glance/server.py", line 456, in delete
    delete_from_backend(image['location'])
  File "/usr/lib/pymodules/python2.6/glance/store/__init__.py", line 94, in delete_from_backend
    return backend_class.delete(parsed_uri, **kwargs)
  File "/usr/lib/pymodules/python2.6/glance/store/swift.py", line 180, in delete
    swift_conn.delete_object(container, obj)
  File "/usr/lib/pymodules/python2.6/swift/common/client.py", line 839, in delete_object
    return self._retry(None, delete_object, container, obj)
  File "/usr/lib/pymodules/python2.6/swift/common/client.py", line 734, in _retry
    self.url, self.token = self.get_auth()
  File "/usr/lib/pymodules/python2.6/swift/common/client.py", line 722, in get_auth
    return get_auth(self.authurl, self.user, self.key, snet=self.snet)
  File "/usr/lib/pymodules/python2.6/swift/common/client.py", line 177, in get_auth
    parsed, conn = http_connection(url)
  File "/usr/lib/pymodules/python2.6/swift/common/client.py", line 153, in http_connection
    conn = HTTPSConnection(parsed.netloc)
  File "/usr/lib/python2.6/httplib.py", line 1101, in __init__
    HTTPConnection.__init__(self, host, port, strict, timeout)
  File "/usr/lib/python2.6/httplib.py", line 657, in __init__
    self._set_hostport(host, port)
  File "/usr/lib/python2.6/httplib.py", line 682, in _set_hostport
    raise InvalidURL("nonnumeric port: '%s'" % host[i+1:])
InvalidURL: nonnumeric port: ''
2011-04-26 18:05:08 DEBUG [eventlet.wsgi.server] 127.0.0.1 - - [26/Apr/2011 18:05:08] "DELETE /images/1 HTTP/1.1" 500 2509 0.012554
2011-04-26 18:05:08 DEBUG [eventlet.wsgi.server] 127.0.0.1 - - [26/Apr/2011 18:05:08] "GET /images/1 HTTP/1.1" 200 543 0.017775

Is it a bug or I made a mistake in my platform ?

Regards,
Édouard.

Question information

Language:
English Edit question
Status:
Solved
For:
Glance Edit question
Assignee:
No assignee Edit question
Solved by:
Édouard Thuleau
Solved:
2011-08-04
Last query:
2011-08-04
Last reply:
2011-04-27
Jay Pipes (jaypipes) said : #1

Hi Edouard!

It looks like our URL parser isn't properly parsing "swift://glance:ethuleau:nah2eeBo@https://p-hs21-15-swift-proxy-1:11000/v1.0//glance/1" and picking up that 11000 is the port.

I'll turn this into a bug and get to fixing it. :)

Cheers!
jay

Édouard Thuleau (ethuleau) said : #2

Hi Jay,

Thanks for your answer and your future fix.

I have the same error when Nova tries to get an image from Glance repository.

Regards,
Édouard.

Jay Pipes (jaypipes) said : #3

Hey again,

Could you paste your glance.conf. Thanks!

jay

Édouard Thuleau (ethuleau) said : #4

My Glance configuration :

[DEFAULT]
verbose = True

debug = True

log_config = /etc/glance/logging.cnf
log_file = /var/log/glance/glance.log
log_dir = /var/log/glance/

[app:glance-api]
paste.app_factory = glance.server:app_factory

default_store = swift

bind_host = 0.0.0.0
bind_port = 9292

registry_host = 0.0.0.0
registry_port = 9191

swift_store_auth_address = https://p-hs21-15-swift-proxy-1:11000/v1.0/
swift_store_user = glance:ethuleau
swift_store_key = nah2eeBo
swift_store_container = glance
swift_store_create_container_on_put = True

[app:glance-registry]
paste.app_factory = glance.registry.server:app_factory

bind_host = 0.0.0.0
bind_port = 9191

sql_connection=mysql://root:nova@127.0.0.1/glance2
sql_idle_timeout = 3600

Édouard Thuleau (ethuleau) said : #5

Nice.