Skip to content

Commit

Permalink
Added Sahara Node Group Templates scenarios
Browse files Browse the repository at this point in the history
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
Konovalov-Nik committed Jul 31, 2014
1 parent f75df33 commit f166abd
Show file tree
Hide file tree
Showing 12 changed files with 481 additions and 1 deletion.
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
}
}
}
]
}
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
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
}
}
}
]
}
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
28 changes: 28 additions & 0 deletions rally-scenarios/rally.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,34 @@
tenants: 2
users_per_tenant: 10

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

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

Authenticate.validate_cinder:
-
args:
Expand Down
Empty file.
92 changes: 92 additions & 0 deletions rally/benchmark/scenarios/sahara/node_group_templates.py
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)
98 changes: 98 additions & 0 deletions rally/benchmark/scenarios/sahara/utils.py
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)
5 changes: 4 additions & 1 deletion rally/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class _Service(utils.ImmutableMixin, utils.EnumMixin):
CEILOMETER = "ceilometer"
S3 = "s3"
TROVE = "trove"
SAHARA = "sahara"


class _ServiceType(utils.ImmutableMixin, utils.EnumMixin):
Expand All @@ -108,6 +109,7 @@ class _ServiceType(utils.ImmutableMixin, utils.EnumMixin):
METERING = "metering"
S3 = "s3"
DATABASE = "database"
DATA_PROCESSING = "data_processing"

def __init__(self):
self.__names = {
Expand All @@ -123,7 +125,8 @@ def __init__(self):
self.NETWORK: _Service.NEUTRON,
self.METERING: _Service.CEILOMETER,
self.S3: _Service.S3,
self.DATABASE: _Service.TROVE
self.DATABASE: _Service.TROVE,
self.DATA_PROCESSING: _Service.SAHARA
}

def __getitem__(self, service_type):
Expand Down
Empty file.
Loading

0 comments on commit f166abd

Please sign in to comment.