From 9b1b65a4395511b07e15a521de3a3a66c4bdcfaa Mon Sep 17 00:00:00 2001 From: Jason Kölker Date: Mon, 12 Dec 2011 16:41:40 -0600 Subject: Fix _poll_bandwidth_usage if no network on vif Bugfix for lp901819 Move DB lookups out of the virt layer for bw usage. Migrate to storing the mac address in the table. Only lookup network label when sending usage events. Attempt to use info_cache for label lookup before punting to rpc call. Change-Id: Iffb4bc220804be7d5fe26d6416b90cd747b72753 --- nova/virt/xenapi_conn.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'nova/virt') diff --git a/nova/virt/xenapi_conn.py b/nova/virt/xenapi_conn.py index 26e36b911..e034cb3ca 100644 --- a/nova/virt/xenapi_conn.py +++ b/nova/virt/xenapi_conn.py @@ -328,13 +328,9 @@ class XenAPIConnection(driver.ComputeDriver): for iusage in self._vmops.get_all_bw_usage(start_time, stop_time).\ values(): for macaddr, usage in iusage.iteritems(): - vi = db.virtual_interface_get_by_address( - context.get_admin_context(), - macaddr) - if vi: - bwusage.append(dict(virtual_interface=vi, - bw_in=usage['bw_in'], - bw_out=usage['bw_out'])) + bwusage.append(dict(mac_address=macaddr, + bw_in=usage['bw_in'], + bw_out=usage['bw_out'])) return bwusage def get_console_output(self, instance): -- cgit