'Receives an InstanceList object from a compute node.
This method receives information from a compute node when it starts up,
or when its instances have changed, and updates its view of hosts and
instances with it.'

@utils.synchronized(HOST_INSTANCE_SEMAPHORE)
def update_instance_info(self, context, host_name, instance_info):

    host_info = self._instance_info.get(host_name)
    if host_info:
        inst_dict = host_info.get('instances')
        for instance in instance_info.objects:
            inst_dict[instance.uuid] = instance
        host_info['updated'] = True
    else:
        instances = instance_info.objects
        if (len(instances) > 1):
            host_info = self._instance_info[host_name] = {}
            host_info['instances'] = {instance.uuid: instance for instance in instances}
            host_info['updated'] = True
        else:
            self._recreate_instance_info(context, host_name)
            LOG.info(_LI("Received    an    update    from    an    unknown    host    '%s'.    Re-created    its    InstanceList."), host_name)
