diff options
author | Monsyne Dragon <mdragon@rackspace.com> | 2012-11-05 17:46:55 +0000 |
---|---|---|
committer | Monsyne Dragon <mdragon@rackspace.com> | 2012-11-05 17:46:55 +0000 |
commit | 65644195fed64a2b4e70c797b4faeddedd12a3d6 (patch) | |
tree | 0f16c8d275f6ace53bf85ac51b6ae5fce0ce20f0 | |
parent | 10979da33ca790b86976c1909624c1440020abe0 (diff) | |
download | nova-65644195fed64a2b4e70c797b4faeddedd12a3d6.tar.gz nova-65644195fed64a2b4e70c797b4faeddedd12a3d6.tar.xz nova-65644195fed64a2b4e70c797b4faeddedd12a3d6.zip |
Fix bandwidth polling exception.
When the bandwidth polling task tries to update bw usage for an
instance that does not have an entry for the last two periods already
in the bw_usage_cache table, it will throw an exception in the
polling task. This was just a misses 'if' statement.
Also:
xenserver: fix swapped bw data in xs plugin.
This fixes bug 1075255
Change-Id: I44bb143039fcdfc8dacb13b67ae8f79dc5f38777
-rw-r--r-- | nova/compute/manager.py | 5 | ||||
-rwxr-xr-x | plugins/xenserver/xenapi/etc/xapi.d/plugins/bandwidth | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 39c3faddf..9cd7c0588 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -2815,8 +2815,9 @@ class ComputeManager(manager.SchedulerDependentManager): bw_ctr['uuid'], prev_time, bw_ctr['mac_address']) - last_ctr_in = usage['last_ctr_in'] - last_ctr_out = usage['last_ctr_out'] + if usage: + last_ctr_in = usage['last_ctr_in'] + last_ctr_out = usage['last_ctr_out'] if last_ctr_in is not None: if bw_ctr['bw_in'] < last_ctr_in: diff --git a/plugins/xenserver/xenapi/etc/xapi.d/plugins/bandwidth b/plugins/xenserver/xenapi/etc/xapi.d/plugins/bandwidth index 171011a06..4c4538fa4 100755 --- a/plugins/xenserver/xenapi/etc/xapi.d/plugins/bandwidth +++ b/plugins/xenserver/xenapi/etc/xapi.d/plugins/bandwidth @@ -38,7 +38,7 @@ def _read_proc_net(): dev = devmap.get(dom, {}) # Note, we deliberately swap in and out, as instance traffic # shows up inverted due to going though the bridge. (mdragon) - dev[vifnum] = dict(bw_in=int(slist[0]), bw_out=int(slist[8])) + dev[vifnum] = dict(bw_in=int(slist[8]), bw_out=int(slist[0])) devmap[dom] = dev return devmap |