

@logging.log_deploy_wrapper(LOG.info, _('Create containers on host'))
def create_servers(self):
    host_provider = self.get_host_provider()
    name_prefix = self.config['container_name_prefix']
    hosts = []
    if ('start_lxc_network' in self.config):
        network = netaddr.IPNetwork(self.config['start_lxc_network'])
    else:
        network = None
    distribution = self.config.get('distribution', 'ubuntu')
    release = self.config.get('release')
    for server in host_provider.create_servers():
        config = {
            'tunnel_to': self.config.get('tunnel_to', []),
            'forward_ssh': self.config.get('forward_ssh', False),
        }
        if network:
            config['network'] = str(network)
        host = LxcHost(server, config)
        host.prepare()
        ip = (str(network.ip).replace('.', '-') if network else '0')
        first_name = ('%s-000-%s' % (name_prefix, ip))
        host.create_container(first_name, distribution, release)
        for i in range(1, self.config.get('containers_per_host', 1)):
            name = ('%s-%03d-%s' % (name_prefix, i, ip))
            host.create_clone(name, first_name)
        host.start_containers()
        hosts.append(host)
        if network:
            network += 1
    servers = []
    for host in hosts:
        for server in host.get_server_objects():
            servers.append(server)
        info = {
            'host': host.server.get_credentials(),
            'config': hosts.config,
            'forwarded_ports': host._port_cache.items(),
            'container_names': host.containers,
        }
        self.resources.create(info)
    return servers

dataset/ETHPy150Open openstack/rally/rally/deployment/serverprovider/providers/lxc.py LxcProvider.create_servers/VarMisuse@345/463 `host`->`hosts`