I am periodically seeing this error in my nova.log file. Not sure what's causing this.
2012-08-23 17:12:55 INFO nova.compute.manager [-] Updating host status
2012-08-23 17:13:00 ERROR nova.manager [-] Error during SchedulerManager._expire_reservations: 'Reservation' object has no attribute 'usage'
2012-08-23 17:13:00 TRACE nova.manager Traceback (most recent call last):
2012-08-23 17:13:00 TRACE nova.manager File "/usr/local/lib/python2.7/dist-packages/nova-2012.2-py2.7.egg/nova/manager.py", line 173, in periodic_tasks
2012-08-23 17:13:00 TRACE nova.manager task(self, context)
2012-08-23 17:13:00 TRACE nova.manager File "/usr/local/lib/python2.7/dist-packages/nova-2012.2-py2.7.egg/nova/scheduler/manager.py", line 288, in _expire_reservations
2012-08-23 17:13:00 TRACE nova.manager QUOTAS.expire(context)
2012-08-23 17:13:00 TRACE nova.manager File "/usr/local/lib/python2.7/dist-packages/nova-2012.2-py2.7.egg/nova/quota.py", line 757, in expire
2012-08-23 17:13:00 TRACE nova.manager self._driver.expire(context)
2012-08-23 17:13:00 TRACE nova.manager File "/usr/local/lib/python2.7/dist-packages/nova-2012.2-py2.7.egg/nova/quota.py", line 380, in expire
2012-08-23 17:13:00 TRACE nova.manager db.reservation_expire(context)
2012-08-23 17:13:00 TRACE nova.manager File "/usr/local/lib/python2.7/dist-packages/nova-2012.2-py2.7.egg/nova/db/api.py", line 1066, in reservation_expire
2012-08-23 17:13:00 TRACE nova.manager return IMPL.reservation_expire(context)
2012-08-23 17:13:00 TRACE nova.manager File "/usr/local/lib/python2.7/dist-packages/nova-2012.2-py2.7.egg/nova/db/sqlalchemy/api.py", line 112, in wrapper
2012-08-23 17:13:00 TRACE nova.manager return f(*args, **kwargs)
2012-08-23 17:13:00 TRACE nova.manager File "/usr/local/lib/python2.7/dist-packages/nova-2012.2-py2.7.egg/nova/db/sqlalchemy/api.py", line 2864, in reservation_expire
2012-08-23 17:13:00 TRACE nova.manager reservation.usage.reserved -= reservation.delta
2012-08-23 17:13:00 TRACE nova.manager AttributeError: 'Reservation' object has no attribute 'usage'
2012-08-23 17:13:00 TRACE nova.manager
Thanks for the report!
I've just reproduced this by:
1) Set reservation_ expire= 10 and periodic_ interval= 20 in nova.conf
2) Do 'nova secgroup-create foo bar' twice (see #1043765)
3) Confirm that we have a lingering reservation from that failure by running 'select * from reservations where deleted=0;' against the nova DB
Wait a while and, sure enough, I see the same exception you do.
By the way, whatever caused the quota reservation to leak is a bug too. It would be good to track that bug down. A good start is to look at the 'resource' column of the leaked reservations.