Merge "Selective resource creation in dynamic workloads"
This commit is contained in:
commit
47eacfe85e
@ -61,10 +61,13 @@ class DynamicWorkload(vm.VMDynamicScenario, trunk.TrunkDynamicScenario,
|
||||
router_create_args=None, network_create_args=None,
|
||||
subnet_create_args=None, **kwargs):
|
||||
|
||||
context_ext_net_id = self.context["external_networks"][((self.context["iteration"]-1)
|
||||
% num_external_networks)]["id"]
|
||||
self.log_info("Using external network {} from context for iteration {}".format(
|
||||
context_ext_net_id, self.context["iteration"]))
|
||||
if num_external_networks > 0:
|
||||
context_ext_net_id = self.context["external_networks"][((self.context["iteration"]-1)
|
||||
% num_external_networks)]["id"]
|
||||
self.log_info("Using external network {} from context for iteration {}".format(
|
||||
context_ext_net_id, self.context["iteration"]))
|
||||
self.ext_net_name = self.clients("neutron").show_network(context_ext_net_id)["network"][
|
||||
"name"]
|
||||
|
||||
workloads_list = workloads.split(",")
|
||||
self.trunk_vm_user = "centos"
|
||||
@ -76,21 +79,25 @@ class DynamicWorkload(vm.VMDynamicScenario, trunk.TrunkDynamicScenario,
|
||||
self.security_group = self.create_sec_group_with_icmp_ssh()
|
||||
self.log_info("security group {} created for this iteration".format(self.security_group))
|
||||
|
||||
# Let this router be used by resources created by VM dynamic workloads in this iteration,
|
||||
# if the iteration is not divisible by 5.
|
||||
router_create_args["name"] = self.generate_random_name()
|
||||
router_create_args["tenant_id"] = self.context["tenant"]["id"]
|
||||
router_create_args.setdefault(
|
||||
"external_gateway_info", {"network_id": context_ext_net_id, "enable_snat": True}
|
||||
)
|
||||
self.router = self._create_router(router_create_args)
|
||||
self.log_info("router {} created for this iteration".format(self.router))
|
||||
if(workloads == "all" or "migrate_servers" in workloads_list or
|
||||
"swap_floating_ips_between_servers" in workloads_list or
|
||||
"stop_start_servers" in workloads_list or
|
||||
"pod_fip_simulation" in workloads_list or
|
||||
"add_subports_to_random_trunks" in workloads_list or
|
||||
"delete_subports_from_random_trunks" in workloads_list or
|
||||
"swap_floating_ips_between_random_subports" in workloads_list):
|
||||
# Let this router be used by resources created by VM and trunk dynamic workloads
|
||||
# in this iteration.
|
||||
router_create_args["name"] = self.generate_random_name()
|
||||
router_create_args["tenant_id"] = self.context["tenant"]["id"]
|
||||
router_create_args.setdefault(
|
||||
"external_gateway_info", {"network_id": context_ext_net_id, "enable_snat": True}
|
||||
)
|
||||
self.router = self._create_router(router_create_args)
|
||||
self.log_info("router {} created for this iteration".format(self.router))
|
||||
|
||||
self.keypair = self.context["user"]["keypair"]
|
||||
|
||||
self.ext_net_name = self.clients("neutron").show_network(context_ext_net_id)["network"][
|
||||
"name"]
|
||||
|
||||
try:
|
||||
self.browbeat_dir = DynamicWorkload.browbeat_dir
|
||||
except AttributeError:
|
||||
|
@ -33,7 +33,7 @@ class CreateExternalNetworksContext(context.Context):
|
||||
"properties": {
|
||||
"num_external_networks": {
|
||||
"type": "integer",
|
||||
"minimum": 1
|
||||
"minimum": 0
|
||||
},
|
||||
"interface_name": {
|
||||
"type": "string"
|
||||
|
Loading…
Reference in New Issue
Block a user