Merge "[Manila] Add benchmark for Manila list share servers operation"
This commit is contained in:
commit
e655b3de1c
@ -73,3 +73,15 @@
|
|||||||
sla:
|
sla:
|
||||||
failure_rate:
|
failure_rate:
|
||||||
max: 0
|
max: 0
|
||||||
|
|
||||||
|
ManilaShares.list_share_servers:
|
||||||
|
-
|
||||||
|
args:
|
||||||
|
search_opts: {}
|
||||||
|
runner:
|
||||||
|
type: "constant"
|
||||||
|
times: 10
|
||||||
|
concurrency: 10
|
||||||
|
sla:
|
||||||
|
failure_rate:
|
||||||
|
max: 0
|
||||||
|
@ -121,3 +121,16 @@ class ManilaShares(utils.ManilaScenario):
|
|||||||
detailed=detailed,
|
detailed=detailed,
|
||||||
search_opts=search_opts,
|
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)
|
||||||
|
@ -160,3 +160,15 @@ class ManilaScenario(base.Scenario):
|
|||||||
share_networks = self.clients("manila").share_networks.list(
|
share_networks = self.clients("manila").share_networks.list(
|
||||||
detailed=detailed, search_opts=search_opts)
|
detailed=detailed, search_opts=search_opts)
|
||||||
return share_networks
|
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
|
||||||
|
14
samples/tasks/scenarios/manila/list-share-servers.json
Normal file
14
samples/tasks/scenarios/manila/list-share-servers.json
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"ManilaShares.list_share_servers": [
|
||||||
|
{
|
||||||
|
"args": {
|
||||||
|
"search_opts": {}
|
||||||
|
},
|
||||||
|
"runner": {
|
||||||
|
"type": "constant",
|
||||||
|
"times": 10,
|
||||||
|
"concurrency": 10
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
9
samples/tasks/scenarios/manila/list-share-servers.yaml
Normal file
9
samples/tasks/scenarios/manila/list-share-servers.yaml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
ManilaShares.list_share_servers:
|
||||||
|
-
|
||||||
|
args:
|
||||||
|
search_opts: {}
|
||||||
|
runner:
|
||||||
|
type: "constant"
|
||||||
|
times: 10
|
||||||
|
concurrency: 10
|
@ -132,3 +132,19 @@ class ManilaSharesTestCase(test.TestCase):
|
|||||||
**expected_create_params)
|
**expected_create_params)
|
||||||
scenario._list_share_networks.assert_called_once_with(
|
scenario._list_share_networks.assert_called_once_with(
|
||||||
**expected_list_params)
|
**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)
|
||||||
|
@ -131,3 +131,20 @@ class ManilaScenarioTestCase(test.ClientsTestCase):
|
|||||||
self.clients("manila").share_networks.list.assert_called_once_with(
|
self.clients("manila").share_networks.list.assert_called_once_with(
|
||||||
detailed=params.get("detailed", True),
|
detailed=params.get("detailed", True),
|
||||||
search_opts=params.get("search_opts", None))
|
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))
|
||||||
|
Loading…
Reference in New Issue
Block a user