Add rally plugin for cluster-size

This patch adds cluster-resize support in senlin rally
plugin as well as a test job for it. It also adds a
README file for rally-jobs of senlin.

Change-Id: I52e5461d44c6b4db16158a3993f75131ab31a1b8
This commit is contained in:
yanyanhu 2016-06-13 03:24:17 -04:00
parent 1b672dcca2
commit f4031bb83c
4 changed files with 132 additions and 20 deletions

11
rally-jobs/README.rst Normal file
View File

@ -0,0 +1,11 @@
This directory contains rally jobs to be run by OpenStack CI.
Structure:
* senlin-senlin.yaml describes rally tasks that will be run in rally-gate.
* plugins - directory containing rally plugins for senlin. These plugins
will be loaded by rally-gate automatically when job is run at gate
side. User can also manually copy those plugins to `~/.rally/plugins`
or `/opt/rally/plugins` to make them work if test is done locally.
Please find more information about rally plugins at the following link:
- https://rally.readthedocs.org/en/latest/plugins.html

View File

@ -103,6 +103,52 @@ class SenlinScenario(scenario.OpenStackScenario):
raise exceptions.GetResourceNotFound(resource=cluster.id)
raise exceptions.GetResourceFailure(resource=cluster.id, err=e)
@atomic.action_timer("senlin.resize_cluster")
def _resize_cluster(self, cluster, adj_type=None, number=None,
min_size=None, max_size=None, min_step=None,
strict=True):
"""Adjust cluster size.
:param cluster: cluster object to resize.
:param adj_type: type of adjustment. If specified, must be one of the
strings defined in `consts.ADJUSTMENT_TYPES`.
:param number: number for adjustment. It is interpreted as the new
desired_capacity of the cluster if `adj_type` is set
to `EXACT_CAPACITY`; it is interpreted as the relative
number of nodes to add/remove when `adj_type` is set
to `CHANGE_IN_CAPACITY`; it is treated as a percentage
when `adj_type` is set to `CHANGE_IN_PERCENTAGE`.
:param min_size: new lower bound of the cluster size, if specified.
:param max_size: new upper bound of the cluster size, if specified.
A value of negative means no upper limit is imposed.
:param min_step: the number of nodes to be added or removed when
`adj_type` is set to value `CHANGE_IN_PERCENTAGE`
and the number calculated is less than 1.
:param strict: whether Senlin should try a best-effort style resizing
or just rejects the request when scaling beyond its
current size constraint.
"""
kwargs = {}
if adj_type:
kwargs['adjustment_type'] = adj_type
if number:
kwargs['number'] = number
if min_size:
kwargs['min_size'] = min_size
if max_size:
kwargs['max_size'] = max_size
if min_step:
kwargs['min_step'] = min_step
kwargs['strict'] = strict
res = self.admin_clients("senlin").cluster_resize(cluster.id, **kwargs)
action = self._get_action(res['action'])
utils.wait_for_status(
action,
ready_statuses=["SUCCEEDED"],
failure_statuses=["FAILED"],
update_resource=self._get_action,
timeout=CONF.benchmark.senlin_action_timeout)
@atomic.action_timer("senlin.delete_cluster")
def _delete_cluster(self, cluster):
"""Delete given cluster.
@ -166,7 +212,7 @@ class SenlinScenario(scenario.OpenStackScenario):
@scenario.configure(context={"cleanup": ["senlin"]})
def create_and_delete_profile_cluster(self, profile_spec,
desired_capacity=0, min_size=0,
max_size=-1, timeout=120,
max_size=-1, timeout=3600,
metadata=None):
"""Create a profile and a cluster and then delete them.
@ -180,11 +226,36 @@ class SenlinScenario(scenario.OpenStackScenario):
:param min_size: The minimum number of nodes owned by the cluster
:param max_size: The maximum number of nodes owned by the cluster.
-1 means no limit
:param timeout: The timeout value in minutes for cluster creation
:param timeout: The timeout value in seconds for cluster creation
:param metadata: A set of key value pairs to associate with the cluster
"""
profile = self._create_profile(profile_spec)
cluster = self._create_cluster(profile.id, desired_capacity,
min_size, max_size, timeout, metadata)
self._delete_cluster(cluster.id)
self._delete_cluster(cluster)
self._delete_profile(profile)
@validation.required_openstack(admin=True)
@validation.required_services(consts.Service.SENLIN)
@scenario.configure(context={"cleanup": ["senlin"]})
def create_resize_delete_cluster(self, profile_spec, create_params,
resize_params, timeout=3600):
"""Create a cluster, resize it and then delete it.
Measure the `senlin cluster-create`, `senlin cluster-resize`
and `senlin cluster-delete` commands performance.
:param profile_spec: the spec dictionary used to create profile
:param create_params: the dictionary provides the parameters for
cluster creation
:param resize_params: the dictionary provides the parameters
for cluster resizing
:param timeout: The timeout value in seconds for each cluster
action, including creation, deletion and resizing
"""
profile = self._create_profile(profile_spec)
cluster = self._create_cluster(profile.id, timeout=timeout,
**create_params)
self._resize_cluster(cluster, **resize_params)
self._delete_cluster(cluster)
self._delete_profile(profile)

View File

@ -16,9 +16,43 @@
min_size: 0
max_size: 3
runner:
type: "constant"
type: constant
times: 2
concurrency: 1
concurrency: 2
context:
users:
tenants: 1
users_per_tenant: 1
sla:
failure_rate:
max: 0
SenlinScenario.create_resize_delete_cluster:
-
args:
profile_spec:
type: os.nova.server
version: 1.0
properties:
name: cirros_server
flavor: 1
image: cirros-0.3.4-x86_64-uec
networks:
- network: private
create_params:
desired_capacity: 0
min_size: 0
max_size: 1
resize_params:
adj_type: CHANGE_IN_CAPACITY
number: 3
min_size: 0
max_size: 3
strict: false
runner:
type: constant
times: 2
concurrency: 2
context:
users:
tenants: 1

View File

@ -1069,29 +1069,25 @@ class EngineService(service.Service):
strict=True):
"""Adjust cluster size parameters.
:param identity: cluster dentity which can be name, id or short ID;
:param adj_type: optional; if specified, must be one of the strings
defined in consts.ADJUSTMENT_TYPES;
:param identity: cluster identity which can be cluster name, UUID or
short ID.
:param adj_type: type of adjustment. If specified, must be one of the
strings defined in `consts.ADJUSTMENT_TYPES`.
:param number: number for adjustment. It is interpreted as the new
desired_capacity of the cluster if `adj_type` is set
to `EXACT_CAPACITY`; it is interpreted as the relative
number of nodes to add/remove when `adj_type` is set
to `CHANGE_IN_CAPACITY`; it is treated as a percentage
when `adj_type` is set to `CHANGE_IN_PERCENTAGE`.
This parameter is optional.
:param min_size: new lower bound of the cluster size, if specified.
This parameter is optional.
:param max_size: new upper bound of the cluster size, if specified;
:param max_size: new upper bound of the cluster size, if specified.
A value of negative means no upper limit is imposed.
This parameter is optional.
:param min_step: optional. It specifies the number of nodes to be
added or removed when `adj_type` is set to value
`CHANGE_IN_PERCENTAGE` and the number calculated is
less than 1 or so.
:param strict: optional boolean value. It specifies whether Senlin
should try a best-effort style resizing or just
reject the request when scaling beyond its current
size constraint.
:param min_step: the number of nodes to be added or removed when
`adj_type` is set to value `CHANGE_IN_PERCENTAGE`
and the number calculated is less than 1.
:param strict: whether Senlin should try a best-effort style resizing
or just rejects the request when scaling beyond its
current size constraint.
:return: A dict containing the ID of an action fired.
"""