Fix getting nwinfo for Instance obj
This fixes the get_nw_info_for_instance() method in nova/compute/utils. If an instance object has no 'info_cache' (means we lack an entry in the instance_info_caches table for the instance), don't try to access the 'network_info' attribute. Just return a network model with empty networking information like the dict version of an instance would do. Change-Id: Ib1f49f10cefeefc55a87fea69b6fbc772c978dca Closes-bug: 1243291
This commit is contained in:
@@ -346,6 +346,8 @@ def notify_about_aggregate_update(context, event_suffix, aggregate_payload):
|
||||
|
||||
def get_nw_info_for_instance(instance):
|
||||
if isinstance(instance, instance_obj.Instance):
|
||||
if instance.info_cache is None:
|
||||
return network_model.NetworkInfo.hydrate([])
|
||||
return instance.info_cache.network_info
|
||||
# FIXME(comstud): Transitional while we convert to objects.
|
||||
info_cache = instance['info_cache'] or {}
|
||||
|
||||
Reference in New Issue
Block a user