summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-02-28 15:04:30 +0000
committerGerrit Code Review <review@openstack.org>2012-02-28 15:04:30 +0000
commit2f8163bb28136698fb9f65bd003b4feb9dd08d4f (patch)
treed8d223b4afb7fd9aa0e7fa7a2710d81fba3c8a19
parentd2bb5db9fa308cd98a26a4a9629410ad43d1a109 (diff)
parent0c2ce3980459526a01696b63ea5d5294987ad19b (diff)
downloadnova-2f8163bb28136698fb9f65bd003b4feb9dd08d4f.tar.gz
nova-2f8163bb28136698fb9f65bd003b4feb9dd08d4f.tar.xz
nova-2f8163bb28136698fb9f65bd003b4feb9dd08d4f.zip
Merge "Handle case where instance['info_cache'] is None"
-rw-r--r--nova/api/ec2/ec2utils.py3
-rw-r--r--nova/api/openstack/common.py3
2 files changed, 4 insertions, 2 deletions
diff --git a/nova/api/ec2/ec2utils.py b/nova/api/ec2/ec2utils.py
index e0f336d4c..e44ae287e 100644
--- a/nova/api/ec2/ec2utils.py
+++ b/nova/api/ec2/ec2utils.py
@@ -86,7 +86,8 @@ def get_ip_info_for_instance_from_nw_info(nw_info):
def get_ip_info_for_instance(context, instance):
"""Return a dictionary of IP information for an instance"""
- cached_nwinfo = instance['info_cache']['network_info']
+ info_cache = instance['info_cache'] or {}
+ cached_nwinfo = info_cache.get('network_info')
# Make sure empty response is turned into []
if not cached_nwinfo:
cached_nwinfo = []
diff --git a/nova/api/openstack/common.py b/nova/api/openstack/common.py
index 12fbb509b..bc49a3948 100644
--- a/nova/api/openstack/common.py
+++ b/nova/api/openstack/common.py
@@ -305,7 +305,8 @@ def get_networks_for_instance_from_nw_info(nw_info):
def get_nw_info_for_instance(context, instance):
- cached_nwinfo = instance['info_cache'].get('network_info') or []
+ info_cache = instance['info_cache'] or {}
+ cached_nwinfo = info_cache.get('network_info') or []
return network_model.NetworkInfo.hydrate(cached_nwinfo)