Skip to content

@vishvananda /gist:1905214
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
diff --git a/nova/api/openstack/common.py b/nova/api/openstack/common.py
index 92ef176..5f97e70 100644
--- a/nova/api/openstack/common.py
+++ b/nova/api/openstack/common.py
@@ -304,6 +304,11 @@ def get_networks_for_instance_from_nw_info(nw_info):
return networks
+def get_nwinfo_for_instance(context, instance):
+ cached_nwinfo = instance['info_cache'].get('network_info') or []
+ return network_model.NetworkInfo.hydrate(cached_nwinfo)
+
+
def get_networks_for_instance(context, instance):
"""Returns a prepared nw_info list for passing into the view
builders
@@ -315,11 +320,7 @@ def get_networks_for_instance(context, instance):
{'addr': '172.16.2.1', 'version': 4}]},
...}
"""
-
- cached_nwinfo = instance['info_cache']['network_info']
- if not cached_nwinfo:
- return {}
- nw_info = network_model.NetworkInfo.hydrate(cached_nwinfo)
+ nw_info = get_nwinfo_for_instance(context, instance)
return get_networks_for_instance_from_nw_info(nw_info)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.