Traceback when QuotaUsage.updated_at is NULL

Bug #1197259 reported by Kieran Spear on 2013-07-03
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Undecided
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/wsgi.py", line 851, in _process_stack
    action_result = self.dispatch(meth, request, action_args)
  File "/usr/lib/python2.7/dist-packages/cinder/api/openstack/wsgi.py", line 927, in dispatch
    return method(req=request, **action_args)
  File "/usr/lib/python2.7/dist-packages/cinder/api/v1/volumes.py", line 358, in create
    **kwargs)
  File "/usr/lib/python2.7/dist-packages/cinder/volume/api.py", line 148, in create
    reservations = QUOTAS.reserve(context, volumes=1, gigabytes=size)
  File "/usr/lib/python2.7/dist-packages/cinder/quota.py", line 702, in reserve
    project_id=project_id)
  File "/usr/lib/python2.7/dist-packages/cinder/quota.py", line 325, in reserve
    project_id=project_id)
  File "/usr/lib/python2.7/dist-packages/cinder/db/api.py", line 679, in quota_reserve
    until_refresh, max_age, project_id=project_id)
  File "/usr/lib/python2.7/dist-packages/cinder/db/sqlalchemy/api.py", line 123, in wrapper
    return f(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/cinder/db/sqlalchemy/api.py", 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
Review: https://review.openstack.org/37250

Changed in cinder:
status: Confirmed → In Progress

Reviewed: https://review.openstack.org/37250
Committed: http://github.com/openstack/cinder/commit/9f75e546aaf2b791868a3eac424462f78dca707f
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