summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
Diffstat (limited to 'nova/api')
-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)