'Attempt to build instance(s) or send msg to child cell.'

def _build_instances(self, message, target_cells, instance_uuids, build_inst_kwargs):

    ctxt = message.ctxt
    instance_properties = obj_base.obj_to_primitive(build_inst_kwargs['instances'][0])
    filter_properties = build_inst_kwargs['filter_properties']
    instance_type = filter_properties['instance_type']
    image = build_inst_kwargs['image']
    security_groups = build_inst_kwargs['security_groups']
    block_device_mapping = build_inst_kwargs['block_device_mapping']
    LOG.debug('Building    instances    with    routing_path=%(routing_path)s', {'routing_path': message.routing_path})
    for target_cell in target_cells:
        try:
            if target_cell.is_me:
                instances = self._create_instances_here(ctxt, instance_uuids, instance_properties, instance_type, image, security_groups, block_device_mapping)
                build_inst_kwargs['instances'] = instances
                self._create_action_here(ctxt, instance_uuids)
                self.compute_task_api.build_instances(ctxt, **build_inst_kwargs)
                return
            self.msg_runner.build_instances(ctxt, target_cell, build_inst_kwargs)
            return
        except Exception:
            LOG.exception("Couldn't    communicate    with    cell    '%s'", target_cell.name)
    LOG.error("Couldn't    communicate    with    any    cells")
    raise exception.NoCellsAvailable()
