From b8eed845d72f266a929f773ff08b1c8c641e913f Mon Sep 17 00:00:00 2001 From: Chris Behrens Date: Tue, 26 Jun 2012 02:06:35 +0000 Subject: Remove unnecessary queries for network info in notifications bandwidth_usage() tries to query network info if "not network_info" when looking at instance['info_cache']. [] is a valid entry for network_info (on build)... so don't query network when we see it. Fixes bug 1017770 Change-Id: Ia7291dbbcc25c04eff16eb048068f879e18f53a4 --- nova/notifications.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nova/notifications.py b/nova/notifications.py index 654ba5d25..29bca2c2f 100644 --- a/nova/notifications.py +++ b/nova/notifications.py @@ -158,7 +158,7 @@ def bandwidth_usage(instance_ref, audit_start, admin_context = nova.context.get_admin_context(read_deleted='yes') if (instance_ref.get('info_cache') and - instance_ref['info_cache'].get('network_info')): + instance_ref['info_cache'].get('network_info') is not None): cached_info = instance_ref['info_cache']['network_info'] nw_info = network_model.NetworkInfo.hydrate(cached_info) -- cgit