forked from openstack/rally
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Sahara Node Group Templates scenarios
One scenraio creates two types of node group templates and executes a list operation. The other creates and deletes popular types of node group templates. Change-Id: Ie37151bb1ff195e6e0a67d85e693333da68f96e9
- Loading branch information
1 parent
f75df33
commit f166abd
Showing
12 changed files
with
481 additions
and
1 deletion.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
doc/samples/tasks/scenarios/sahara/create_and_list_node_group_templates.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"SaharaNodeGroupTemplates.create_and_list_node_group_templates": [ | ||
{ | ||
"args": { | ||
"flavor": { | ||
"name": "m1.small" | ||
} | ||
}, | ||
"runner": { | ||
"type": "constant", | ||
"times": 100, | ||
"concurrency": 10 | ||
}, | ||
"context": { | ||
"users": { | ||
"tenants": 1, | ||
"users_per_tenant": 1 | ||
} | ||
} | ||
} | ||
] | ||
} |
14 changes: 14 additions & 0 deletions
14
doc/samples/tasks/scenarios/sahara/create_and_list_node_group_templates.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
SaharaNodeGroupTemplates.create_and_list_node_group_templates: | ||
- | ||
args: | ||
flavor: | ||
name: "m1.small" | ||
runner: | ||
type: "constant" | ||
times: 100 | ||
concurrency: 10 | ||
context: | ||
users: | ||
tenants: 1 | ||
users_per_tenant: 1 |
22 changes: 22 additions & 0 deletions
22
doc/samples/tasks/scenarios/sahara/create_delete_node_group_templates.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"SaharaNodeGroupTemplates.create_delete_node_group_templates": [ | ||
{ | ||
"args": { | ||
"flavor": { | ||
"name": "m1.small" | ||
} | ||
}, | ||
"runner": { | ||
"type": "constant", | ||
"times": 100, | ||
"concurrency": 10 | ||
}, | ||
"context": { | ||
"users": { | ||
"tenants": 1, | ||
"users_per_tenant": 1 | ||
} | ||
} | ||
} | ||
] | ||
} |
14 changes: 14 additions & 0 deletions
14
doc/samples/tasks/scenarios/sahara/create_delete_node_group_templates.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
SaharaNodeGroupTemplates.create_delete_node_group_templates: | ||
- | ||
args: | ||
flavor: | ||
name: "m1.small" | ||
runner: | ||
type: "constant" | ||
times: 100 | ||
concurrency: 10 | ||
context: | ||
users: | ||
tenants: 1 | ||
users_per_tenant: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
# Copyright 2014: Mirantis Inc. | ||
# All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
# not use this file except in compliance with the License. You may obtain | ||
# a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
|
||
from rally.benchmark.scenarios import base | ||
from rally.benchmark.scenarios.sahara import utils | ||
from rally.benchmark import types | ||
from rally.benchmark import validation | ||
from rally import consts | ||
|
||
|
||
class SaharaNodeGroupTemplates(utils.SaharaScenario): | ||
|
||
@types.set(flavor=types.FlavorResourceType) | ||
@validation.add(validation.flavor_exists('flavor')) | ||
@base.scenario(context={"cleanup": ["sahara"]}) | ||
@validation.required_services(consts.Service.SAHARA) | ||
def create_and_list_node_group_templates(self, flavor, | ||
plugin_name="vanilla", | ||
hadoop_version="1.2.1"): | ||
"""Test the sahara Node Group Templates create and list commands. | ||
This scenario creates two Node Group Templates with different set of | ||
node processes. The master Node Group Template contains Hadoop's | ||
management processes. The worker Node Group Template contains | ||
Haddop's worker processes. | ||
By default the templates are created for the vanilla Hadoop | ||
provisioning plugin using the version 1.2.1 | ||
After the templates are created the list operation is called. | ||
:param flavor: The Nova flavor that will be for nodes in the | ||
created node groups | ||
:param plugin_name: The name of a provisioning plugin | ||
:param hadoop_version: The version of Hadoop distribution supported by | ||
the specified plugin. | ||
""" | ||
|
||
self._create_master_node_group_template(flavor_id=flavor, | ||
plugin_name=plugin_name, | ||
hadoop_version=hadoop_version) | ||
self._create_worker_node_group_template(flavor_id=flavor, | ||
plugin_name=plugin_name, | ||
hadoop_version=hadoop_version) | ||
self._list_node_group_templates() | ||
|
||
@types.set(flavor=types.FlavorResourceType) | ||
@validation.add(validation.flavor_exists('flavor')) | ||
@base.scenario(context={"cleanup": ["sahara"]}) | ||
@validation.required_services(consts.Service.SAHARA) | ||
def create_delete_node_group_templates(self, flavor, | ||
plugin_name="vanilla", | ||
hadoop_version="1.2.1"): | ||
"""Test create and delete commands. | ||
This scenario creates and deletes two most common types of | ||
Node Group Templates. | ||
By default the templates are created for the vanilla Hadoop | ||
provisioning plugin using the version 1.2.1 | ||
:param flavor: The Nova flavor that will be for nodes in the | ||
created node groups | ||
:param plugin_name: The name of a provisioning plugin | ||
:param hadoop_version: The version of Hadoop distribution supported by | ||
the specified plugin. | ||
""" | ||
|
||
master_ngt = self._create_master_node_group_template( | ||
flavor_id=flavor, | ||
plugin_name=plugin_name, | ||
hadoop_version=hadoop_version) | ||
|
||
worker_ngt = self._create_worker_node_group_template( | ||
flavor_id=flavor, | ||
plugin_name=plugin_name, | ||
hadoop_version=hadoop_version) | ||
|
||
self._delete_node_group_template(master_ngt) | ||
self._delete_node_group_template(worker_ngt) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# Copyright 2014: Mirantis Inc. | ||
# All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
# not use this file except in compliance with the License. You may obtain | ||
# a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
|
||
from rally.benchmark.scenarios import base | ||
from rally.benchmark.scenarios import utils | ||
|
||
|
||
class SaharaScenario(base.Scenario): | ||
|
||
RESOURCE_NAME_LENGTH = 20 | ||
|
||
# TODO(nkonovalov): Add other provisioning plugins | ||
NODE_PROCESSES = { | ||
"vanilla": { | ||
"1.2.1": { | ||
"master": ["namenode", "jobtracker"], | ||
"worker": ["datanode", "tasktracker"] | ||
}, | ||
"2.3.0": { | ||
"master": ["namenode", "resourcemanager", "historyserver"], | ||
"worker": ["datanode", "nodemanager"] | ||
} | ||
} | ||
} | ||
|
||
@utils.atomic_action_timer('sahara.list_node_group_templates') | ||
def _list_node_group_templates(self): | ||
"""Returns user Node Group Templates list.""" | ||
|
||
return self.clients("sahara").node_group_templates.list() | ||
|
||
@utils.atomic_action_timer( | ||
'sahara.create_master_node_group_template') | ||
def _create_master_node_group_template(self, flavor_id, plugin_name, | ||
hadoop_version): | ||
"""Creates a master Node Group Template with a random name. | ||
:param flavor_id: The required argument for the Template | ||
:param plugin_name: Sahara provisioning plugin name | ||
:param hadoop_version: The version of Hadoop distribution supported by | ||
the plugin | ||
:return: The created Template | ||
""" | ||
|
||
name = self._generate_random_name(prefix="master-ngt-") | ||
|
||
return self.clients("sahara").node_group_templates.create( | ||
name=name, | ||
plugin_name=plugin_name, | ||
hadoop_version=hadoop_version, | ||
flavor_id=flavor_id, | ||
node_processes=self.NODE_PROCESSES[plugin_name][hadoop_version] | ||
["master"]) | ||
|
||
@utils.atomic_action_timer( | ||
'sahara.create_worker_node_group_template') | ||
def _create_worker_node_group_template(self, flavor_id, plugin_name, | ||
hadoop_version): | ||
"""Creates a worker Node Group Template with a random name. | ||
:param flavor_id: The required argument for the Template | ||
:param plugin_name: Sahara provisioning plugin name | ||
:param hadoop_version: The version of Hadoop distribution supported by | ||
the plugin | ||
:return: The created Template | ||
""" | ||
|
||
name = self._generate_random_name(prefix="worker-ngt-") | ||
|
||
return self.clients("sahara").node_group_templates.create( | ||
name=name, | ||
plugin_name=plugin_name, | ||
hadoop_version=hadoop_version, | ||
flavor_id=flavor_id, | ||
node_processes=self.NODE_PROCESSES[plugin_name][hadoop_version] | ||
["worker"]) | ||
|
||
@utils.atomic_action_timer('sahara.delete_node_group_template') | ||
def _delete_node_group_template(self, node_group): | ||
"""Deletes a Node Group Template by id. | ||
:param node_group: The Node Group Template to be deleted | ||
:return: | ||
""" | ||
|
||
self.clients("sahara").node_group_templates.delete(node_group.id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Oops, something went wrong.