[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
a9aa76ca12
commit
06a442a603
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,
|
||||
|
@ -237,6 +237,27 @@ class Clients(object):
|
||||
client.client.auth_token = kc.auth_token
|
||||
return client
|
||||
|
||||
@cached
|
||||
def manila(self, version="1"):
|
||||
"""Return manila client."""
|
||||
from manilaclient import client as manila
|
||||
manila_client = manila.Client(
|
||||
version,
|
||||
region_name=self.endpoint.region_name,
|
||||
http_log_debug=logging.is_debug(),
|
||||
timeout=CONF.openstack_client_http_timeout,
|
||||
insecure=self.endpoint.insecure,
|
||||
cacert=self.endpoint.cacert,
|
||||
**self._get_auth_info(password_key="api_key",
|
||||
project_name_key="project_name"))
|
||||
kc = self.keystone()
|
||||
manila_client.client.management_url = kc.service_catalog.url_for(
|
||||
service_type="share",
|
||||
endpoint_type=self.endpoint.endpoint_type,
|
||||
region_name=self.endpoint.region_name)
|
||||
manila_client.client.auth_token = kc.auth_token
|
||||
return manila_client
|
||||
|
||||
@cached
|
||||
def ceilometer(self, version="2"):
|
||||
"""Return ceilometer client."""
|
||||
|
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))
|
@ -266,6 +266,36 @@ class OSClientsTestCase(test.TestCase):
|
||||
self.fake_keystone.auth_token)
|
||||
self.assertEqual(fake_cinder, self.clients.cache["cinder"])
|
||||
|
||||
def test_manila(self):
|
||||
mock_manila = mock.MagicMock()
|
||||
self.assertNotIn("manila", self.clients.cache)
|
||||
with mock.patch.dict("sys.modules", {"manilaclient": mock_manila}):
|
||||
client = self.clients.manila()
|
||||
self.assertEqual(mock_manila.client.Client.return_value, client)
|
||||
self.service_catalog.url_for.assert_called_once_with(
|
||||
service_type="share",
|
||||
endpoint_type=consts.EndpointType.PUBLIC,
|
||||
region_name=self.endpoint.region_name)
|
||||
mock_manila.client.Client.assert_called_once_with(
|
||||
"1",
|
||||
http_log_debug=False,
|
||||
timeout=cfg.CONF.openstack_client_http_timeout,
|
||||
insecure=False, cacert=None,
|
||||
username=self.endpoint.username,
|
||||
api_key=self.endpoint.password,
|
||||
region_name=self.endpoint.region_name,
|
||||
project_name=self.endpoint.tenant_name,
|
||||
auth_url=self.endpoint.auth_url)
|
||||
self.assertEqual(
|
||||
mock_manila.client.Client.return_value.client.management_url,
|
||||
self.service_catalog.url_for.return_value)
|
||||
self.assertEqual(
|
||||
mock_manila.client.Client.return_value.client.auth_token,
|
||||
self.fake_keystone.auth_token)
|
||||
self.assertEqual(
|
||||
mock_manila.client.Client.return_value,
|
||||
self.clients.cache["manila"])
|
||||
|
||||
def test_ceilometer(self):
|
||||
fake_ceilometer = fakes.FakeCeilometerClient()
|
||||
mock_ceilometer = mock.MagicMock()
|
||||
|
Loading…
Reference in New Issue
Block a user