Traceback when QuotaUsage.updated_at is NULL

Bug #1197259 reported by Kieran Spear on 2013-07-03
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Haomai Wang

Bug Description

2013-07-03 10:14:18 ERROR [cinder.api.openstack.wsgi] Exception handling resource: unsupported operand type(s) for -: 'NoneType' and 'datetime.datetime'
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/cinder/api/openstack/", line 851, in _process_stack
    action_result = self.dispatch(meth, request, action_args)
  File "/usr/lib/python2.7/dist-packages/cinder/api/openstack/", line 927, in dispatch
    return method(req=request, **action_args)
  File "/usr/lib/python2.7/dist-packages/cinder/api/v1/", line 358, in create
  File "/usr/lib/python2.7/dist-packages/cinder/volume/", line 148, in create
    reservations = QUOTAS.reserve(context, volumes=1, gigabytes=size)
  File "/usr/lib/python2.7/dist-packages/cinder/", line 702, in reserve
  File "/usr/lib/python2.7/dist-packages/cinder/", line 325, in reserve
  File "/usr/lib/python2.7/dist-packages/cinder/db/", line 679, in quota_reserve
    until_refresh, max_age, project_id=project_id)
  File "/usr/lib/python2.7/dist-packages/cinder/db/sqlalchemy/", line 123, in wrapper
    return f(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/cinder/db/sqlalchemy/", line 698, in quota_reserve
    timeutils.utcnow()).seconds >= max_age:
TypeError: unsupported operand type(s) for -: 'NoneType' and 'datetime.datetime'

 662 @require_context
 663 def quota_reserve(context, resources, quotas, deltas, expire,
 664 until_refresh, max_age, project_id=None):
 697 elif max_age and (usages[resource].updated_at -
 698 timeutils.utcnow()).seconds >= max_age:
 699 refresh = True

Kieran Spear (kspear) on 2013-07-03
summary: - Trackback when QuotaUsage.updated_at is NULL
+ Traceback when QuotaUsage.updated_at is NULL
Haomai Wang (haomai) wrote :

(usages[resource].updated_at -
                              timeutils.utcnow()).seconds >= max_age:

usages[resource] is a instance of QuotaUsage, and QuotaUsage isn't have a column called `updated_at`.

Changed in cinder:
status: New → Confirmed
assignee: nobody → Haomai Wang (haomai)
Haomai Wang (haomai) wrote :

I'm sorry that I made a folly mistake for last comment.

Changed in cinder:
status: Confirmed → New
assignee: Haomai Wang (haomai) → nobody
Haomai Wang (haomai) on 2013-07-16
Changed in cinder:
assignee: nobody → Haomai Wang (haomai)
status: New → Confirmed

Fix proposed to branch: master

Changed in cinder:
status: Confirmed → In Progress

Submitter: Jenkins
Branch: master

commit 9f75e546aaf2b791868a3eac424462f78dca707f
Author: Haomai Wang <email address hidden>
Date: Tue Jul 16 21:47:19 2013 +0800

    Fix error when QuotaUsage.updated_at is NULL

    When QuotaUsage.updated_at is None, it will raise non-expected exception.
    Just verify it.

    Fix bug 1197259

    Change-Id: I2b41d025f8cffa6c0b3f0153a5194d5e7b1a05df

Changed in cinder:
status: In Progress → Fix Committed
Thierry Carrez (ttx) on 2013-07-17
Changed in cinder:
milestone: none → havana-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2013-10-17
Changed in cinder:
milestone: havana-2 → 2013.2
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers