summaryrefslogtreecommitdiffstats
path: root/nova/compute
diff options
context:
space:
mode:
authorMichael Kerrin <michael.kerrin@hp.com>2013-06-06 08:52:52 +0000
committerMichael Kerrin <michael.kerrin@hp.com>2013-06-07 16:03:09 +0000
commit4aee80dd31131675ae0ab9f927b2d4aed0b8426a (patch)
tree4baaf55a8b2ef11a24e884018f644d689c06fd8c /nova/compute
parent7a475d3cd606e68090075c1a8944e3aeb7898b87 (diff)
downloadnova-4aee80dd31131675ae0ab9f927b2d4aed0b8426a.tar.gz
nova-4aee80dd31131675ae0ab9f927b2d4aed0b8426a.tar.xz
nova-4aee80dd31131675ae0ab9f927b2d4aed0b8426a.zip
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
Diffstat (limited to 'nova/compute')
-rwxr-xr-xnova/compute/manager.py8
-rw-r--r--nova/compute/utils.py9
2 files changed, 10 insertions, 7 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index 2390eb3c3..8434a64ca 100755
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -3782,7 +3782,7 @@ class ComputeManager(manager.SchedulerDependentManager):
return compute_host_bdms
- def _update_volume_usage_cache(self, context, vol_usages, refreshed):
+ def _update_volume_usage_cache(self, context, vol_usages):
"""Updates the volume usage cache table with a list of stats."""
for usage in vol_usages:
# Allow switching of greenthreads between queries.
@@ -3792,8 +3792,7 @@ class ComputeManager(manager.SchedulerDependentManager):
usage['rd_bytes'],
usage['wr_req'],
usage['wr_bytes'],
- usage['instance'],
- last_refreshed=refreshed)
+ usage['instance'])
@periodic_task.periodic_task
def _poll_volume_usage(self, context, start_time=None):
@@ -3820,8 +3819,7 @@ class ComputeManager(manager.SchedulerDependentManager):
except NotImplementedError:
return
- refreshed = timeutils.utcnow()
- self._update_volume_usage_cache(context, vol_usages, refreshed)
+ self._update_volume_usage_cache(context, vol_usages)
@periodic_task.periodic_task
def _report_driver_status(self, context):
diff --git a/nova/compute/utils.py b/nova/compute/utils.py
index 1ce115b20..621f558cb 100644
--- a/nova/compute/utils.py
+++ b/nova/compute/utils.py
@@ -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'],