def _get_instances_with_cached_ips(orig_func, *args, **kwargs):
 instances = orig_func(*args, **kwargs)
 context = args[0]
 fake_device = objects.PciDevice.get_by_dev_addr(context, 1, 'a')
 def _info_cache_for(instance):
  info_cache = dict(test_instance_info_cache.fake_info_cache, network_info=_get_fake_cache(), instance_uuid=instance['uuid'])
  if isinstance(instance, obj_base.NovaObject):
   _info_cache = objects.InstanceInfoCache(context)
   objects.InstanceInfoCache._from_db_object(context, _info_cache, info_cache)
   info_cache = _info_cache
  instance['info_cache'] = info_cache
 if isinstance(instances, (list, obj_base.ObjectListBase)):
  for instance in instances:
   _info_cache_for(instance)
   fake_device.claim(instance.uuid)
   fake_device.allocate(instance)
 else:
  _info_cache_for(instances)
  fake_device.claim(instances.uuid)
  fake_device.allocate(instances)
 return instances

def _get_instances_with_cached_ips ( orig_func , * args , ** kwargs ) : instances = orig_func ( * args , ** kwargs ) context = args [ 0 ] fake_device = objects . PciDevice . get_by_dev_addr ( context , 1 , 'a' ) def _info_cache_for ( instance ) : info_cache = dict ( test_instance_info_cache . fake_info_cache , network_info = _get_fake_cache ( ) , instance_uuid = instance [ 'uuid' ] ) if isinstance ( instance , obj_base . NovaObject ) : _info_cache = objects . InstanceInfoCache ( context ) objects . InstanceInfoCache . _from_db_object ( context , _info_cache , info_cache ) info_cache = _info_cache instance [ 'info_cache' ] = info_cache if isinstance ( instances , ( list , obj_base . ObjectListBase ) ) : for instance in instances : _info_cache_for ( instance ) fake_device . claim ( instance . uuid ) fake_device . allocate ( instance ) else : _info_cache_for ( instances ) fake_device . claim ( instances . uuid ) fake_device . allocate ( instances ) return instances
kludge the cache into instance(s) without having to create db entries .