Created
February 25, 2012 01:53
-
-
Save vishvananda/1905214 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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