Problem with mapping of timestamps with glance

Bug #741429 reported by justinsb
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
justinsb

Bug Description

When I was trying to launch an image with a non-deleted image from glance, I hit the following exception:

2011-03-24 02:45:36,012 ERROR nova.api [F-V0NVACOWF073ISJKXG justinsb justinsb] Unexpected error raised: time data '' does not match format '%Y-%m-%dT%H:%M:%S.%f'
(nova.api): TRACE: Traceback (most recent call last):
(nova.api): TRACE: File "/root/openstack/superstack/nova/api/ec2/__init__.py", line 318, in __call__
(nova.api): TRACE: result = api_request.invoke(context)
(nova.api): TRACE: File "/root/openstack/superstack/nova/api/ec2/apirequest.py", line 150, in invoke
(nova.api): TRACE: result = method(context, **args)
(nova.api): TRACE: File "/root/openstack/superstack/nova/api/ec2/cloud.py", line 804, in run_instances
(nova.api): TRACE: image_id=self._get_image(context, kwargs['image_id'])['id'],
(nova.api): TRACE: File "/root/openstack/superstack/nova/api/ec2/cloud.py", line 872, in _get_image
(nova.api): TRACE: return self.image_service.show(context, internal_id)
(nova.api): TRACE: File "/root/openstack/superstack/nova/image/s3.py", line 96, in show
(nova.api): TRACE: image = self.service.show(context, image_id)
(nova.api): TRACE: File "/root/openstack/superstack/nova/image/glance.py", line 69, in show
(nova.api): TRACE: return self._convert_timestamps_to_datetimes(image)
(nova.api): TRACE: File "/root/openstack/superstack/nova/image/glance.py", line 78, in _convert_timestamps_to_datetimes
(nova.api): TRACE: image[attr] = self._parse_glance_iso8601_timestamp(image[attr])
(nova.api): TRACE: File "/root/openstack/superstack/nova/image/glance.py", line 85, in _parse_glance_iso8601_timestamp
(nova.api): TRACE: return datetime.datetime.strptime(timestamp, "%Y-%m-%dT%H:%M:%S.%f")
(nova.api): TRACE: File "/usr/lib/python2.6/_strptime.py", line 325, in _strptime
(nova.api): TRACE: (data_string, format))
(nova.api): TRACE: ValueError: time data '' does not match format '%Y-%m-%dT%H:%M:%S.%f'
(nova.api): TRACE:

The image in question looks like this when printed:
{'status': 'active', 'name': 'lucid-x86', 'deleted': 'False', 'container_format': 'bare', 'created_at': '2011-03-23T20:43:21.907246', 'disk_format': 'qcow2', 'updated_at': '2011-03-23T20:43:36.167948', 'properties': {'type': 'machine'}, 'location': 'file:///var/lib/glance/images/11', 'is_public': 'True', 'deleted_at': '', 'id': '11', 'size': '398393344'}

The problem is that deleted_at is '', not None.

Related branches

Changed in nova:
assignee: nobody → justinsb (justin-fathomdb)
Revision history for this message
Ed Leafe (ed-leafe) wrote :

The problem isn't just 'deleted_at' being an empty string. I'm getting:

2011-03-24 12:47:20,303 ERROR nova.api.openstack [-] Caught error: time data '2011-03-16T20:33:46' does not match format '%Y-%m-%dT%H:%M:%S.%f'

Full traceback here: http://paste.openstack.org/show/989/

Revision history for this message
Mark Washenberger (markwash) wrote :

Hey guys,

Looks like these problems are related to my recent change.

Justin, regarding your bug--I mistakenly thought the glance client was already returning None, since the glance image service is supposed to return None and it was simply returning what it got from the glance client. I will fix this promptly.

Ed,

It looks like the date format you are seeing is not the same as what you would get from glance trunk--but I might be missing something. What version of glance are you using, and what version of python are you running it with?

Sorry about these problems, guys.

Revision history for this message
Mark Washenberger (markwash) wrote :

Well, Justin, I didn't notice that you had already assigned this to yourself. Let me know if you need anything.

Revision history for this message
justinsb (justin-fathomdb) wrote :

My patch merged. Sorry Ed, it doesn't deal with your issue. I guess you should probably open a separate bug report - looks like a much more complicated case anyway! It might even be a glance bug, as I presume that's where this string is coming from. (Or is this yet another case where the different image drivers are returning subtly different data formats?)

Changed in nova:
status: New → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → 2011.2
status: Fix Committed → Fix Released
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.