[Manila] Add benchmark for Manila list share servers operation

List of changes:
- Added support of 'list' operation for share servers.
- Added benchmark for listing of share servers.

Change-Id: Iea34c51eaf3cf73de52f882b09592a793a3159c1
This commit is contained in:
Valeriy Ponomaryov 2015-06-12 11:57:35 +03:00
parent 94eb770cac
commit b27fb8d5c5
7 changed files with 93 additions and 0 deletions

View File

@ -73,3 +73,15 @@
sla:
failure_rate:
max: 0
ManilaShares.list_share_servers:
-
args:
search_opts: {}
runner:
type: "constant"
times: 10
concurrency: 10
sla:
failure_rate:
max: 0

View File

@ -121,3 +121,16 @@ class ManilaShares(utils.ManilaScenario):
detailed=detailed,
search_opts=search_opts,
)
@validation.required_services(consts.Service.MANILA)
@validation.required_openstack(admin=True)
@base.scenario()
def list_share_servers(self, search_opts=None):
"""Lists share servers.
Requires admin creds.
:param search_opts: container of following search opts:
"host", "status", "share_network" and "project_id".
"""
self._list_share_servers(search_opts=search_opts)

View File

@ -160,3 +160,15 @@ class ManilaScenario(base.Scenario):
share_networks = self.clients("manila").share_networks.list(
detailed=detailed, search_opts=search_opts)
return share_networks
@base.atomic_action_timer("manila.list_share_servers")
def _list_share_servers(self, search_opts=None):
"""List share servers. Admin only.
:param search_opts: set of key-value pairs to filter share servers by.
Example: {"share_network": "share_network_name_or_id"}
:returns: list of instances of :class:`ShareServer`
"""
share_servers = self.admin_clients("manila").share_servers.list(
search_opts=search_opts)
return share_servers

View File

@ -0,0 +1,14 @@
{
"ManilaShares.list_share_servers": [
{
"args": {
"search_opts": {}
},
"runner": {
"type": "constant",
"times": 10,
"concurrency": 10
}
}
]
}

View File

@ -0,0 +1,9 @@
---
ManilaShares.list_share_servers:
-
args:
search_opts: {}
runner:
type: "constant"
times: 10
concurrency: 10

View File

@ -132,3 +132,19 @@ class ManilaSharesTestCase(test.TestCase):
**expected_create_params)
scenario._list_share_networks.assert_called_once_with(
**expected_list_params)
@ddt.data(
{},
{"search_opts": None},
{"search_opts": {}},
{"search_opts": {"foo": "bar"}},
)
def test_list_share_servers(self, search_opts):
scenario = shares.ManilaShares()
scenario.context = {"admin": {"endpoint": "fake_endpoint"}}
scenario._list_share_servers = mock.MagicMock()
scenario.list_share_servers(search_opts=search_opts)
scenario._list_share_servers.assert_called_once_with(
search_opts=search_opts)

View File

@ -131,3 +131,20 @@ class ManilaScenarioTestCase(test.ClientsTestCase):
self.clients("manila").share_networks.list.assert_called_once_with(
detailed=params.get("detailed", True),
search_opts=params.get("search_opts", None))
@ddt.data(
{},
{"search_opts": None},
{"search_opts": {"project_id": "fake_project"}},
)
def test__list_share_servers(self, params):
fake_share_servers = ["foo", "bar"]
self.admin_clients("manila").share_servers.list.return_value = (
fake_share_servers)
result = self.scenario._list_share_servers(**params)
self.assertEqual(fake_share_servers, result)
self.admin_clients(
"manila").share_servers.list.assert_called_once_with(
search_opts=params.get("search_opts", None))