[Manila] Add base benchmark for list shares operation
List of changes: - Added general support of Manila project. - Added support of 'list' operation for shares. - Added benchmark for listing of shares. - Added two different manila jobs scripts that will be used for two different Manila installtions. Current benchmark is used without changes in both installations. Change-Id: Ie29be6162e788c880aea6816803c9ddea340bcf7
This commit is contained in:
parent
ed2996dac1
commit
eda7d96106
16
rally-jobs/rally-manila-no-ss.yaml
Normal file
16
rally-jobs/rally-manila-no-ss.yaml
Normal file
@ -0,0 +1,16 @@
|
||||
---
|
||||
ManilaShares.list_shares:
|
||||
-
|
||||
args:
|
||||
detailed: True
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 10
|
||||
concurrency: 1
|
||||
context:
|
||||
users:
|
||||
tenants: 1
|
||||
users_per_tenant: 1
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 0
|
16
rally-jobs/rally-manila.yaml
Normal file
16
rally-jobs/rally-manila.yaml
Normal file
@ -0,0 +1,16 @@
|
||||
---
|
||||
ManilaShares.list_shares:
|
||||
-
|
||||
args:
|
||||
detailed: True
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 10
|
||||
concurrency: 1
|
||||
context:
|
||||
users:
|
||||
tenants: 1
|
||||
users_per_tenant: 1
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 0
|
@ -90,6 +90,7 @@ class _Service(utils.ImmutableMixin, utils.EnumMixin):
|
||||
NOVAV3 = "novav3"
|
||||
CINDER = "cinder"
|
||||
CINDERV2 = "cinderv2"
|
||||
MANILA = "manila"
|
||||
EC2 = "ec2"
|
||||
GLANCE = "glance"
|
||||
CLOUD = "cloud"
|
||||
@ -111,6 +112,7 @@ class _ServiceType(utils.ImmutableMixin, utils.EnumMixin):
|
||||
|
||||
VOLUME = "volume"
|
||||
VOLUMEV2 = "volumev2"
|
||||
SHARE = "share"
|
||||
EC2 = "ec2"
|
||||
IMAGE = "image"
|
||||
CLOUD = "cloudformation"
|
||||
@ -136,6 +138,7 @@ class _ServiceType(utils.ImmutableMixin, utils.EnumMixin):
|
||||
self.COMPUTEV3: _Service.NOVAV3,
|
||||
self.VOLUME: _Service.CINDER,
|
||||
self.VOLUMEV2: _Service.CINDER,
|
||||
self.SHARE: _Service.MANILA,
|
||||
self.EC2: _Service.EC2,
|
||||
self.IMAGE: _Service.GLANCE,
|
||||
self.CLOUD: _Service.CLOUD,
|
||||
|
36
rally/plugins/openstack/scenarios/manila/shares.py
Normal file
36
rally/plugins/openstack/scenarios/manila/shares.py
Normal file
@ -0,0 +1,36 @@
|
||||
# Copyright 2015 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 import validation
|
||||
from rally import consts
|
||||
from rally.plugins.openstack.scenarios.manila import utils
|
||||
|
||||
|
||||
class ManilaShares(utils.ManilaScenario):
|
||||
"""Benchmark scenarios for Manila shares."""
|
||||
|
||||
@validation.required_services(consts.Service.MANILA)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario()
|
||||
def list_shares(self, detailed=True, search_opts=None):
|
||||
"""Basic scenario for 'share list' operation.
|
||||
|
||||
:param detailed: defines either to return detailed list of
|
||||
objects or not.
|
||||
:param search_opts: container of search opts such as
|
||||
"name", "host", "share_type", etc.
|
||||
"""
|
||||
self._list_shares(detailed=detailed, search_opts=search_opts)
|
32
rally/plugins/openstack/scenarios/manila/utils.py
Normal file
32
rally/plugins/openstack/scenarios/manila/utils.py
Normal file
@ -0,0 +1,32 @@
|
||||
# Copyright 2015 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
|
||||
|
||||
|
||||
class ManilaScenario(base.Scenario):
|
||||
"""Base class for Manila scenarios with basic atomic actions."""
|
||||
|
||||
@base.atomic_action_timer("manila.list_shares")
|
||||
def _list_shares(self, detailed=True, search_opts=None):
|
||||
"""Returns user shares list.
|
||||
|
||||
:param detailed: defines either to return detailed list of
|
||||
objects or not.
|
||||
:param search_opts: container of search opts such as
|
||||
"name", "host", "share_type", etc.
|
||||
"""
|
||||
return self.clients("manila").shares.list(
|
||||
detailed=detailed, search_opts=search_opts)
|
@ -26,6 +26,7 @@ python-keystoneclient>=1.6.0
|
||||
python-novaclient>=2.22.0
|
||||
python-neutronclient>=2.3.11,<3
|
||||
python-cinderclient>=1.2.1
|
||||
python-manilaclient>=1.0.4
|
||||
python-heatclient>=0.3.0
|
||||
python-ceilometerclient>=1.0.13
|
||||
python-ironicclient>=0.2.1
|
||||
|
20
samples/tasks/scenarios/manila/list-shares.json
Normal file
20
samples/tasks/scenarios/manila/list-shares.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"ManilaShares.list_shares": [
|
||||
{
|
||||
"args": {
|
||||
"detailed": true
|
||||
},
|
||||
"runner": {
|
||||
"type": "constant",
|
||||
"times": 10,
|
||||
"concurrency": 1
|
||||
},
|
||||
"context": {
|
||||
"users": {
|
||||
"tenants": 1,
|
||||
"users_per_tenant": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
13
samples/tasks/scenarios/manila/list-shares.yaml
Normal file
13
samples/tasks/scenarios/manila/list-shares.yaml
Normal file
@ -0,0 +1,13 @@
|
||||
---
|
||||
ManilaShares.list_shares:
|
||||
-
|
||||
args:
|
||||
detailed: True
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 10
|
||||
concurrency: 1
|
||||
context:
|
||||
users:
|
||||
tenants: 1
|
||||
users_per_tenant: 1
|
@ -4,6 +4,7 @@
|
||||
hacking>=0.9.2,<0.10
|
||||
|
||||
coverage>=3.6
|
||||
ddt>=0.7.0
|
||||
discover
|
||||
mock>=1.0
|
||||
testrepository>=0.0.18
|
||||
|
46
tests/unit/plugins/openstack/scenarios/manila/test_shares.py
Normal file
46
tests/unit/plugins/openstack/scenarios/manila/test_shares.py
Normal file
@ -0,0 +1,46 @@
|
||||
# Copyright 2015 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.
|
||||
|
||||
import ddt
|
||||
import mock
|
||||
|
||||
from rally.plugins.openstack.scenarios.manila import shares
|
||||
from tests.unit import test
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
class ManilaSharesTestCase(test.TestCase):
|
||||
|
||||
@ddt.data(
|
||||
{},
|
||||
{"detailed": True},
|
||||
{"detailed": False},
|
||||
{"search_opts": None},
|
||||
{"search_opts": {}},
|
||||
{"search_opts": {"foo": "bar"}},
|
||||
{"detailed": True, "search_opts": None},
|
||||
{"detailed": False, "search_opts": None},
|
||||
{"detailed": True, "search_opts": {"foo": "bar"}},
|
||||
{"detailed": False, "search_opts": {"quuz": "foo"}},
|
||||
)
|
||||
@ddt.unpack
|
||||
def test_list_shares(self, detailed=True, search_opts=None):
|
||||
scenario = shares.ManilaShares()
|
||||
scenario._list_shares = mock.MagicMock()
|
||||
|
||||
scenario.list_shares(detailed=detailed, search_opts=search_opts)
|
||||
|
||||
scenario._list_shares.assert_called_once_with(
|
||||
detailed=detailed, search_opts=search_opts)
|
48
tests/unit/plugins/openstack/scenarios/manila/test_utils.py
Normal file
48
tests/unit/plugins/openstack/scenarios/manila/test_utils.py
Normal file
@ -0,0 +1,48 @@
|
||||
# Copyright 2015 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.
|
||||
|
||||
import ddt
|
||||
import mock
|
||||
|
||||
from rally.plugins.openstack.scenarios.manila import utils
|
||||
from tests.unit import test
|
||||
|
||||
MANILA_UTILS = "rally.plugins.openstack.scenarios.manila.utils.ManilaScenario."
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
class ManilaScenarioTestCase(test.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(ManilaScenarioTestCase, self).setUp()
|
||||
self.scenario = utils.ManilaScenario()
|
||||
|
||||
@ddt.data(
|
||||
{},
|
||||
{"detailed": False, "search_opts": None},
|
||||
{"detailed": True, "search_opts": {"name": "foo_sn"}},
|
||||
{"search_opts": {"project_id": "fake_project"}},
|
||||
)
|
||||
@mock.patch(MANILA_UTILS + "clients")
|
||||
def test__list_shares(self, params, mock_clients):
|
||||
fake_shares = ["foo", "bar"]
|
||||
mock_clients.return_value.shares.list.return_value = fake_shares
|
||||
|
||||
result = self.scenario._list_shares(**params)
|
||||
|
||||
self.assertEqual(fake_shares, result)
|
||||
mock_clients.return_value.shares.list.assert_called_once_with(
|
||||
detailed=params.get("detailed", True),
|
||||
search_opts=params.get("search_opts", None))
|
Loading…
Reference in New Issue
Block a user