summaryrefslogtreecommitdiffstats
path: root/nova/compute
diff options
context:
space:
mode:
authorDan Smith <danms@us.ibm.com>2012-12-07 11:19:03 -0800
committerDan Smith <danms@us.ibm.com>2012-12-10 06:49:42 -0800
commit8e9bdd77c8986fa9a688bc263a71c72a0fddc77b (patch)
tree854058a6fa83c72f66ca5ff804e5adf58b8976b6 /nova/compute
parentf6c394cce473f58da704bc1c5230c57ca80f299d (diff)
Use conductor for bw_usage operations
This patch moves bw_usage operations from compute manager to conductor. In an effort to reduce the number of API points we're adding to the conductor RPC API, this patch actually only adds an update function, which also returns the current values. This is used by the public conductor API layer to provide both get and update calls through a single remote function. Discussion and comments on this approach are welcomed. Related to blueprint no-db-compute Change-Id: Iabe4cef2bccc8ffcf0ddc76bf7b328c2c4d87112
Diffstat (limited to 'nova/compute')
-rw-r--r--nova/compute/manager.py33
1 files changed, 16 insertions, 17 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index 9dc6f2c3b..ce2642b13 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -2950,20 +2950,19 @@ class ComputeManager(manager.SchedulerDependentManager):
bw_out = 0
last_ctr_in = None
last_ctr_out = None
- usage = self.db.bw_usage_get(context,
- bw_ctr['uuid'],
- start_time,
- bw_ctr['mac_address'])
+ usage = self.conductor_api.bw_usage_get(context,
+ bw_ctr['uuid'],
+ start_time,
+ bw_ctr['mac_address'])
if usage:
bw_in = usage['bw_in']
bw_out = usage['bw_out']
last_ctr_in = usage['last_ctr_in']
last_ctr_out = usage['last_ctr_out']
else:
- usage = self.db.bw_usage_get(context,
- bw_ctr['uuid'],
- prev_time,
- bw_ctr['mac_address'])
+ usage = self.conductor_api.bw_usage_get(
+ context, bw_ctr['uuid'], prev_time,
+ bw_ctr['mac_address'])
if usage:
last_ctr_in = usage['last_ctr_in']
last_ctr_out = usage['last_ctr_out']
@@ -2982,15 +2981,15 @@ class ComputeManager(manager.SchedulerDependentManager):
else:
bw_out += (bw_ctr['bw_out'] - last_ctr_out)
- self.db.bw_usage_update(context,
- bw_ctr['uuid'],
- bw_ctr['mac_address'],
- start_time,
- bw_in,
- bw_out,
- bw_ctr['bw_in'],
- bw_ctr['bw_out'],
- last_refreshed=refreshed)
+ self.conductor_api.bw_usage_update(context,
+ bw_ctr['uuid'],
+ bw_ctr['mac_address'],
+ start_time,
+ bw_in,
+ bw_out,
+ bw_ctr['bw_in'],
+ bw_ctr['bw_out'],
+ last_refreshed=refreshed)
def _get_host_volume_bdms(self, context, host):
"""Return all block device mappings on a compute host"""