Sending volume IO usage broken

This is my fault, I didn't test the sending of notifications
enough when fixing bug 1182102, when the volume IO usage notifications
were been sent too often. This was merged as part of
https://review.openstack.org/#/c/29915

The issue was that the code worked for the first IO usage event (the
one I looked at). Then when constructing the event payload for the second
and following IO usage events the code path ended up comparing a datetime
object from the db with a cached string representation of the last_refreshed
date that was passed into the conductor via the RPC.

Since last_refreshed argument to vol_usage_update in the db layer is
not needed and is causing these issues. I have removed last_refreshed
argument from the db layer and deprecated it from the conduction API.

Change-Id: I2030eb7912c56134ea688a6e8bbfcdeddca28307
This commit is contained in:
Michael Kerrin
2013-06-06 08:52:52 +00:00
parent 7a475d3cd6
commit 4aee80dd31
8 changed files with 129 additions and 59 deletions

View File

@@ -290,8 +290,13 @@ def usage_volume_info(vol_usage):
tot_refreshed = vol_usage['tot_last_refreshed']
curr_refreshed = vol_usage['curr_last_refreshed']
last_refreshed_time = (tot_refreshed if tot_refreshed > curr_refreshed
else curr_refreshed)
if tot_refreshed and curr_refreshed:
last_refreshed_time = max(tot_refreshed, curr_refreshed)
elif tot_refreshed:
last_refreshed_time = tot_refreshed
else:
# curr_refreshed must be set
last_refreshed_time = curr_refreshed
usage_info = dict(
volume_id=vol_usage['volume_id'],