From 07d0210b169b476a5c1817f1fd3acc35e69e2f64 Mon Sep 17 00:00:00 2001 From: RUIJIE YUAN Date: Tue, 6 Dec 2016 17:56:59 +0800 Subject: [PATCH] rally jobs for cluster-scale-in this patch adds rally job to support cluster-scale-in. Change-Id: I71b96d42676fe033995482a67ca80e7f0646725d --- rally-jobs/plugins/senlin_plugin.py | 42 ++++++++++++++++++++++++++++- rally-jobs/senlin-senlin.yaml | 33 +++++++++++++++++++++-- 2 files changed, 72 insertions(+), 3 deletions(-) diff --git a/rally-jobs/plugins/senlin_plugin.py b/rally-jobs/plugins/senlin_plugin.py index d527b508f..5509d4c1a 100644 --- a/rally-jobs/plugins/senlin_plugin.py +++ b/rally-jobs/plugins/senlin_plugin.py @@ -25,7 +25,6 @@ CONF = cfg.CONF class SenlinPlugin(senlin_utils.SenlinScenario): """Base class for Senlin scenarios with basic atomic actions.""" - @atomic.action_timer("senlin.get_action") def _get_action(self, action_id): """Get action details. @@ -81,6 +80,22 @@ class SenlinPlugin(senlin_utils.SenlinScenario): update_resource=self._get_action, timeout=senlin_utils.CONF.benchmark.senlin_action_timeout) + @atomic.action_timer("senlin.cluster_scale_in") + def _scale_in_cluster(self, cluster, count): + """Cluster scale in. + + :param cluster: cluster object. + :param count: number of nodes to be removed from the cluster. + """ + res = self.admin_clients("senlin").cluster_scale_in(cluster.id, count) + action = self._get_action(res["action"]) + utils.wait_for_status( + action, + ready_statuses=["SUCCEEDED"], + failure_statuses=["FAILED"], + update_resource=self._get_action, + timeout=senlin_utils.CONF.benchmark.senlin_action_timeout) + @validation.required_openstack(admin=True) @validation.required_services(consts.Service.SENLIN) @validation.required_contexts("profiles") @@ -104,3 +119,28 @@ class SenlinPlugin(senlin_utils.SenlinScenario): **create_params) self._resize_cluster(cluster, **resize_params) self._delete_cluster(cluster) + + @validation.required_openstack(admin=True) + @validation.required_services(consts.Service.SENLIN) + @validation.required_contexts("profiles") + @scenario.configure(context={"cleanup": ["senlin"]}) + def create_scale_in_delete_cluster(self, desired_capacity=1, + min_size=0, max_size=-1, + count=1): + """Create a cluster, scale-in it and then delete it. + + Measure the `senlin cluster-create`, `senlin cluster-scale-in` + and `senlin cluster-delete` commands performance. + + :param desired_capacity: The capacity or initial number of nodes + owned by the cluster + :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 count: The number of nodes will be removed from the cluster. + """ + profile_id = self.context["tenant"]["profile"] + cluster = self._create_cluster(profile_id, desired_capacity, + min_size, max_size) + self._scale_in_cluster(cluster, count) + self._delete_cluster(cluster) \ No newline at end of file diff --git a/rally-jobs/senlin-senlin.yaml b/rally-jobs/senlin-senlin.yaml index abe681466..4ccd4c02a 100644 --- a/rally-jobs/senlin-senlin.yaml +++ b/rally-jobs/senlin-senlin.yaml @@ -22,7 +22,7 @@ flavor: 1 image: "cirros-0.3.4-x86_64-uec" networks: - - network: private + - network: public sla: failure_rate: max: 0 @@ -56,7 +56,36 @@ flavor: 1 image: "cirros-0.3.4-x86_64-uec" networks: - - network: private + - network: public sla: failure_rate: max: 0 + + SenlinPlugin.create_scale_in_delete_cluster: + - + args: + desired_capacity: 3 + min_size: 0 + max_size: 5 + count: 3 + runner: + type: constant + times: 3 + concurrency: 2 + context: + users: + tenants: 2 + users_per_tenant: 2 + profiles: + type: os.nova.server + version: "1.0" + properties: + name: cirros_server + flavor: 1 + image: "cirros-0.3.4-x86_64-uec" + networks: + - network: public + sla: + failure_rate: + max: 0 +