Merge "Add cidr prefix parameter in dynamic workloads"
This commit is contained in:
commit
38a589e729
@ -643,6 +643,9 @@ workloads:
|
|||||||
shift_on_stack_workload: poddensity
|
shift_on_stack_workload: poddensity
|
||||||
shift_on_stack_kubeconfig_paths:
|
shift_on_stack_kubeconfig_paths:
|
||||||
- /home/stack/.kube/config
|
- /home/stack/.kube/config
|
||||||
|
# External networks with /23 ranges will be created by dynamic workloads.
|
||||||
|
# All these external networks will share the first 16 bits.
|
||||||
|
cidr_prefix: "172.31"
|
||||||
# num_external_networks are the number of the external networks to be
|
# num_external_networks are the number of the external networks to be
|
||||||
# created as part of rally context for dynamic workloads. These external
|
# created as part of rally context for dynamic workloads. These external
|
||||||
# networks will be used in a round robin fashion by the iterations.
|
# networks will be used in a round robin fashion by the iterations.
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
{% set shift_on_stack_burst = shift_on_stack_burst or 20 %}
|
{% set shift_on_stack_burst = shift_on_stack_burst or 20 %}
|
||||||
{% set shift_on_stack_workload = shift_on_stack_workload or 'poddensity' %}
|
{% set shift_on_stack_workload = shift_on_stack_workload or 'poddensity' %}
|
||||||
{% set shift_on_stack_kubeconfig_paths = shift_on_stack_kubeconfig_paths or ['/home/stack/.kube/config'] %}
|
{% set shift_on_stack_kubeconfig_paths = shift_on_stack_kubeconfig_paths or ['/home/stack/.kube/config'] %}
|
||||||
|
{% set cidr_prefix = cidr_prefix or '172.31' %}
|
||||||
{% set num_external_networks = num_external_networks or 16 %}
|
{% set num_external_networks = num_external_networks or 16 %}
|
||||||
{% set router_external = router_external or True %}
|
{% set router_external = router_external or True %}
|
||||||
{% set sla_max_avg_duration = sla_max_avg_duration or 60 %}
|
{% set sla_max_avg_duration = sla_max_avg_duration or 60 %}
|
||||||
@ -114,6 +115,7 @@ BrowbeatPlugin.dynamic_workload:
|
|||||||
num_external_networks: {{ num_external_networks }}
|
num_external_networks: {{ num_external_networks }}
|
||||||
interface_name: '{{ iface_name }}'
|
interface_name: '{{ iface_name }}'
|
||||||
provider_phys_net: '{{ provider_phys_net }}'
|
provider_phys_net: '{{ provider_phys_net }}'
|
||||||
|
cidr_prefix: '{{ cidr_prefix }}'
|
||||||
sla:
|
sla:
|
||||||
max_avg_duration: {{sla_max_avg_duration}}
|
max_avg_duration: {{sla_max_avg_duration}}
|
||||||
max_seconds_per_iteration: {{sla_max_seconds}}
|
max_seconds_per_iteration: {{sla_max_seconds}}
|
||||||
|
@ -31,6 +31,9 @@ class CreateExternalNetworksContext(context.Context):
|
|||||||
"$schema": consts.JSON_SCHEMA,
|
"$schema": consts.JSON_SCHEMA,
|
||||||
"additionalProperties": False,
|
"additionalProperties": False,
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"cidr_prefix": {
|
||||||
|
"type": "string",
|
||||||
|
},
|
||||||
"num_external_networks": {
|
"num_external_networks": {
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"minimum": 0
|
"minimum": 0
|
||||||
@ -58,11 +61,12 @@ class CreateExternalNetworksContext(context.Context):
|
|||||||
"network_id": network_id,
|
"network_id": network_id,
|
||||||
"name": self.net_wrapper.owner.generate_random_name(),
|
"name": self.net_wrapper.owner.generate_random_name(),
|
||||||
"ip_version": 4,
|
"ip_version": 4,
|
||||||
"cidr": "172.31.{}.0/23".format(network_number),
|
"cidr": "{}.{}.0/23".format(self.cidr_prefix, network_number),
|
||||||
"enable_dhcp": False,
|
"enable_dhcp": False,
|
||||||
"gateway_ip": "172.31.{}.1".format(network_number),
|
"gateway_ip": "{}.{}.1".format(self.cidr_prefix, network_number),
|
||||||
"allocation_pools": [{"start": "172.31.{}.2".format(network_number),
|
"allocation_pools": [{"start": "{}.{}.2".format(self.cidr_prefix, network_number),
|
||||||
"end": "172.31.{}.254".format(network_number+1)}]
|
"end": "{}.{}.254".format(
|
||||||
|
self.cidr_prefix, network_number+1)}]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return self.net_wrapper.client.create_subnet(subnet_args)["subnet"]
|
return self.net_wrapper.client.create_subnet(subnet_args)["subnet"]
|
||||||
@ -78,6 +82,7 @@ class CreateExternalNetworksContext(context.Context):
|
|||||||
self.context["external_subnets"] = {}
|
self.context["external_subnets"] = {}
|
||||||
self.num_external_networks = self.config.get("num_external_networks", 16)
|
self.num_external_networks = self.config.get("num_external_networks", 16)
|
||||||
self.interface_name = self.config.get("interface_name", "ens7f1")
|
self.interface_name = self.config.get("interface_name", "ens7f1")
|
||||||
|
self.cidr_prefix = self.config.get("cidr_prefix", "172.31")
|
||||||
|
|
||||||
num_external_networks_created = 0
|
num_external_networks_created = 0
|
||||||
|
|
||||||
@ -114,8 +119,8 @@ class CreateExternalNetworksContext(context.Context):
|
|||||||
has_error_occured = True
|
has_error_occured = True
|
||||||
break
|
break
|
||||||
|
|
||||||
cmd = ["sudo", "ip", "a", "a", "172.31.{}.1/23".format(
|
cmd = ["sudo", "ip", "a", "a", "{}.{}.1/23".format(
|
||||||
num_external_networks_created*2), "dev",
|
self.cidr_prefix, num_external_networks_created*2), "dev",
|
||||||
"{}.{}".format(self.interface_name, num_external_networks_created + 1)]
|
"{}.{}".format(self.interface_name, num_external_networks_created + 1)]
|
||||||
proc = subprocess.Popen(cmd)
|
proc = subprocess.Popen(cmd)
|
||||||
proc.wait()
|
proc.wait()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user