def create_servers(self, **kwargs): """Create servers""" for x in range(MAX_RESOURCES): kwargs.update({ "nics": [{ "net-id": self.rally_networks[x]["network"]["id"] }], "sec_group_suffix": self.suffixes[x], "server_suffix": self.suffixes[x] }) keypair = vpn_utils.create_keypair(self.nova_client, self.suffixes[x]) server = vpn_utils.create_server(self.nova_client, keypair, **kwargs) vpn_utils.assert_server_status(server, **kwargs) with LOCK: self.servers.append(server) self.keypairs.append(keypair) self.server_private_ips.append( vpn_utils.get_server_ip(self.nova_client, server.id, self.suffixes[x])) if (kwargs["DVR_flag"]): qrouter, compute = vpn_utils.wait_for_namespace_creation( "qrouter-", self.router_ids[x], kwargs['compute_creds'], self.private_key_file, kwargs['namespace_creation_timeout']) vpn_utils.write_key_to_compute_node(keypair, self.local_key_files[x], self.remote_key_files[x], compute, self.private_key_file) with LOCK: self.qrouterns_compute_tuples.append((qrouter, compute)) else: vpn_utils.write_key_to_local_path(self.keypairs[x], self.local_key_files[x]) fip = vpn_utils.add_floating_ip(self.nova_client, server) with LOCK: self.server_fips.append(fip)
def create_networks_and_servers(self, **kwargs): with LOCK: keypairs = [] for x in range(MAX_RESOURCES): if self.tenant_ids: router, network, subnet, cidr = vpn_utils.create_network( self.neutron_client, self.neutron_admin_client, self.suffixes[x], self.tenant_ids[x]) else: router, network, subnet, cidr = vpn_utils.create_network( self.neutron_client, self.neutron_admin_client, self.suffixes[x]) self.rally_cidrs.append(cidr) self.rally_subnets.append(subnet) self.rally_networks.append(network) self.rally_routers.append(router) self.router_ids.append(router["router"]['id']) self.rally_router_gw_ips.append( router["router"]["external_gateway_info"] ["external_fixed_ips"][0]["ip_address"]) self.snat_namespaces.append( vpn_utils.wait_for_namespace_creation( "snat-", router, **kwargs)) self.qrouter_namespaces.append( vpn_utils.wait_for_namespace_creation( "qrouter-", router, **kwargs)) keypairs.append(vpn_utils.create_keypair( self.nova_client, self.key_names[x], self.key_file_paths[x])) kwargs.update({ "nics": [{"net-id": self.rally_networks[x]["network"]["id"]}], "sec_group_suffix": self.suffixes[x], "server_suffix": self.suffixes[x] }) server = vpn_utils.create_nova_vm( self.nova_client, keypairs[x], **kwargs) self.server_private_ips.append(vpn_utils.get_server_ip( self.nova_client, server.id, self.suffixes[x])) self.servers.append(server)
def create_servers(self, **kwargs): """Create servers""" for x in range(MAX_RESOURCES): kwargs.update({ "nics": [{"net-id": self.rally_networks[x]["network"]["id"]}], "sec_group_suffix": self.suffixes[x], "server_suffix": self.suffixes[x] }) keypair = vpn_utils.create_keypair( self.nova_client, self.suffixes[x]) server = vpn_utils.create_server( self.nova_client, keypair, **kwargs) vpn_utils.assert_server_status(server, **kwargs) with LOCK: self.servers.append(server) self.keypairs.append(keypair) self.server_private_ips.append(vpn_utils.get_server_ip( self.nova_client, server.id, self.suffixes[x])) if(kwargs["DVR_flag"]): qrouter, compute = vpn_utils.wait_for_namespace_creation( "qrouter-", self.router_ids[x], kwargs['compute_creds'], self.private_key_file, kwargs['namespace_creation_timeout']) vpn_utils.write_key_to_compute_node( keypair, self.local_key_files[x], self.remote_key_files[x], compute, self.private_key_file) with LOCK: self.qrouterns_compute_tuples.append((qrouter, compute)) else: vpn_utils.write_key_to_local_path(self.keypairs[x], self.local_key_files[x]) fip = vpn_utils.add_floating_ip(self.nova_client, server) with LOCK: self.server_fips.append(fip)