Add nova_boot_in_batches_with_delay workload
This patch adds a workload which adds a delay after booting a given number of servers. Change-Id: Icb92782d487a67f146c395c03a86034418ff9dc7
This commit is contained in:
parent
96ce2c8686
commit
c00ff2d45a
@ -404,6 +404,23 @@ workloads:
|
||||
- 8
|
||||
times: 10
|
||||
scenarios:
|
||||
- name: nova-boot-in-batches-with-delay
|
||||
enabled: true
|
||||
image_name: cirro5
|
||||
flavor_name: m1.tiny-cirros
|
||||
# Time to throttle VM boot in seconds
|
||||
delay_time: 600
|
||||
# Number of iterations that can run before delay is introduced
|
||||
# iterations_per_batch should always be greater than concurrency.
|
||||
iterations_per_batch: 10
|
||||
# Number of iterations that should be delayed per batch.
|
||||
# For example, if iterations_per_batch is 3000 and num_iterations_to_delay
|
||||
# is 50, iterations 3000-3050, 6000-6050.... will be delayed.
|
||||
# Setting this value to a small multiple(1x or 2x) of the concurrency is optimal.
|
||||
# num_iterations_to_delay should always be lesser than iterations_per_batch.
|
||||
num_iterations_to_delay: 8
|
||||
num_tenant_networks: 1
|
||||
file: rally/rally-plugins/nova/nova_boot_in_batches_with_delay.yml
|
||||
- name: netcreate-boot
|
||||
enabled: true
|
||||
enable_dhcp: true
|
||||
|
@ -10,6 +10,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import logging
|
||||
import time
|
||||
from rally_openstack.common import consts
|
||||
from rally_openstack.task.scenarios.cinder import utils as cinder_utils
|
||||
from rally_openstack.task.scenarios.nova import utils as nova_utils
|
||||
@ -18,6 +20,7 @@ from rally.task import scenario
|
||||
from rally.task import types
|
||||
from rally.task import validation
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
@types.convert(image={"type": "glance_image"}, flavor={"type": "nova_flavor"})
|
||||
@validation.add("image_valid_on_flavor", flavor_param="flavor", image_param="image")
|
||||
@ -102,3 +105,39 @@ class NovaBootPersistWithNetworkVolumeFip(vm_utils.VMScenario, cinder_utils.Cind
|
||||
volume = self.cinder.create_volume(volume_size)
|
||||
self._attach_volume(server, volume)
|
||||
self._attach_floating_ip(server, external_net_name)
|
||||
|
||||
@types.convert(image={"type": "glance_image"}, flavor={"type": "nova_flavor"})
|
||||
@validation.add("image_valid_on_flavor", flavor_param="flavor", image_param="image")
|
||||
@validation.add("required_services",services=[consts.Service.NOVA, consts.Service.NEUTRON])
|
||||
@validation.add("required_platform", platform="openstack", users=True)
|
||||
@scenario.configure(context={"cleanup@openstack": ["neutron", "nova"]},
|
||||
name="BrowbeatNova.nova_boot_in_batches_with_delay",
|
||||
platform="openstack")
|
||||
class NovaBootInBatchesWithDelay(vm_utils.VMScenario):
|
||||
|
||||
def run(self, image, flavor, delay_time, iterations_per_batch,
|
||||
num_iterations_to_delay, num_tenant_networks, concurrency, **kwargs):
|
||||
"""Boot VMs in batches with delay in between. This scenario is useful for scaling VMs incrementally.
|
||||
:param image: image of the VMs to be booted
|
||||
:param flavor: flavor of the VMs to be booted
|
||||
:param delay_time: int, time in seconds to delay VM boot in between batches
|
||||
:param iterations_per_batch: int, number of iterations that can run before delay occurs
|
||||
:param num_iterations_to_delay: int, number of iterations to delay
|
||||
:param num_tenant_networks: int, number of tenant networks
|
||||
:param concurrency: int, concurrency passed to rally runner
|
||||
"""
|
||||
if iterations_per_batch <= num_iterations_to_delay:
|
||||
raise Exception("num_iterations_to_delay cannot be greater than iterations_per_batch.")
|
||||
if iterations_per_batch <= concurrency:
|
||||
raise Exception("concurrency cannot be greater than iterations_per_batch.")
|
||||
if (self.context["iteration"] % iterations_per_batch <= num_iterations_to_delay and
|
||||
self.context["iteration"] >= iterations_per_batch):
|
||||
LOG.info("Iteration {} delaying VM boot for {} seconds".format(
|
||||
self.context["iteration"], delay_time))
|
||||
time.sleep(delay_time)
|
||||
tenant_network_id = self.context["tenant"]["networks"][((self.context["iteration"]-1)
|
||||
% num_tenant_networks)]["id"]
|
||||
LOG.info("Iteration {} using tenant network {}".format(self.context["iteration"],
|
||||
tenant_network_id))
|
||||
kwargs["nics"] = [{"net-id": tenant_network_id}]
|
||||
self._boot_server(image, flavor, **kwargs)
|
||||
|
47
rally/rally-plugins/nova/nova_boot_in_batches_with_delay.yml
Normal file
47
rally/rally-plugins/nova/nova_boot_in_batches_with_delay.yml
Normal file
@ -0,0 +1,47 @@
|
||||
{% set image_name = image_name or 'cirro5' %}
|
||||
{% set flavor_name = flavor_name or 'm1.tiny-cirros' %}
|
||||
{% set delay_time = delay_time or 600 %}
|
||||
{% set iterations_per_batch = iterations_per_batch or 5 %}
|
||||
{% set num_iterations_to_delay = num_iterations_to_delay or 1 %}
|
||||
{% set num_tenant_networks = num_tenant_networks or 1 %}
|
||||
{% set sla_max_avg_duration = sla_max_avg_duration or 60 %}
|
||||
{% set sla_max_failure = sla_max_failure or 0 %}
|
||||
{% set sla_max_seconds = sla_max_seconds or 60 %}
|
||||
---
|
||||
BrowbeatNova.nova_boot_in_batches_with_delay:
|
||||
-
|
||||
args:
|
||||
flavor:
|
||||
name: '{{flavor_name}}'
|
||||
image:
|
||||
name: '{{image_name}}'
|
||||
delay_time: {{delay_time}}
|
||||
iterations_per_batch: {{iterations_per_batch}}
|
||||
num_iterations_to_delay: {{num_iterations_to_delay}}
|
||||
num_tenant_networks: {{num_tenant_networks}}
|
||||
concurrency: {{concurrency}}
|
||||
runner:
|
||||
concurrency: {{concurrency}}
|
||||
times: {{times}}
|
||||
type: 'constant'
|
||||
context:
|
||||
users:
|
||||
tenants: 1
|
||||
users_per_tenant: 8
|
||||
network:
|
||||
networks_per_tenant: {{num_tenant_networks}}
|
||||
quotas:
|
||||
neutron:
|
||||
network: -1
|
||||
port: -1
|
||||
router: -1
|
||||
subnet: -1
|
||||
nova:
|
||||
instances: -1
|
||||
cores: -1
|
||||
ram: -1
|
||||
sla:
|
||||
max_avg_duration: {{sla_max_avg_duration}}
|
||||
max_seconds_per_iteration: {{sla_max_seconds}}
|
||||
failure_rate:
|
||||
max: {{sla_max_failure}}
|
Loading…
x
Reference in New Issue
Block a user