Merge "Add CinderVolumes.list_transfers"
This commit is contained in:
commit
2e002f2296
@ -753,3 +753,19 @@
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 0
|
||||
|
||||
CinderVolumes.list_transfers:
|
||||
-
|
||||
args:
|
||||
detailed: true
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 3
|
||||
concurrency: 2
|
||||
context:
|
||||
users:
|
||||
tenants: 3
|
||||
users_per_tenant: 2
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 0
|
||||
|
@ -380,3 +380,14 @@ class CinderScenario(scenario.OpenStackScenario):
|
||||
def get_random_server(self):
|
||||
server_id = random.choice(self.context["tenant"]["servers"])
|
||||
return self.clients("nova").servers.get(server_id)
|
||||
|
||||
@atomic.action_timer("cinder.list_transfers")
|
||||
def _list_transfers(self, detailed=True, search_opts=None):
|
||||
"""Get a list of all volume transfers.
|
||||
|
||||
:param detailed: If True, detailed information about transfer
|
||||
should be listed
|
||||
:param search_opts: Search options to filter out volume transfers
|
||||
:returns: list of :class:`VolumeTransfer`
|
||||
"""
|
||||
return self.clients("cinder").transfers.list(detailed, search_opts)
|
||||
|
@ -107,6 +107,25 @@ class ListTypes(cinder_utils.CinderScenario):
|
||||
self._list_types(search_opts, is_public)
|
||||
|
||||
|
||||
@validation.required_services(consts.Service.CINDER)
|
||||
@validation.required_openstack(users=True)
|
||||
@scenario.configure(name="CinderVolumes.list_transfers")
|
||||
class ListTransfers(cinder_utils.CinderScenario):
|
||||
|
||||
def run(self, detailed=True, search_opts=None):
|
||||
"""List all transfers.
|
||||
|
||||
This simple scenario tests the "cinder transfer-list" command by
|
||||
listing all the volume transfers.
|
||||
|
||||
:param detailed: If True, detailed information about volume transfer
|
||||
should be listed
|
||||
:param search_opts: Search options to filter out volume transfers.
|
||||
"""
|
||||
|
||||
self._list_transfers(detailed, search_opts)
|
||||
|
||||
|
||||
@types.convert(image={"type": "glance_image"})
|
||||
@validation.image_exists("image", nullable=True)
|
||||
@validation.required_services(consts.Service.CINDER)
|
||||
|
25
samples/tasks/scenarios/cinder/list-transfers.json
Normal file
25
samples/tasks/scenarios/cinder/list-transfers.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"CinderVolumes.list_transfers": [
|
||||
{
|
||||
"args": {
|
||||
"detailed": true
|
||||
},
|
||||
"runner": {
|
||||
"type": "constant",
|
||||
"times": 3,
|
||||
"concurrency": 2
|
||||
},
|
||||
"context": {
|
||||
"users": {
|
||||
"tenants": 3,
|
||||
"users_per_tenant": 2
|
||||
}
|
||||
},
|
||||
"sla": {
|
||||
"failure_rate": {
|
||||
"max": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
16
samples/tasks/scenarios/cinder/list-transfers.yaml
Normal file
16
samples/tasks/scenarios/cinder/list-transfers.yaml
Normal file
@ -0,0 +1,16 @@
|
||||
---
|
||||
CinderVolumes.list_transfers:
|
||||
-
|
||||
args:
|
||||
detailed: true
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 3
|
||||
concurrency: 2
|
||||
context:
|
||||
users:
|
||||
tenants: 3
|
||||
users_per_tenant: 2
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 0
|
@ -60,6 +60,14 @@ class CinderScenarioTestCase(test.ScenarioTestCase):
|
||||
self._test_atomic_action_timer(self.scenario.atomic_actions(),
|
||||
"cinder.list_snapshots")
|
||||
|
||||
def test__list_transfers(self):
|
||||
return_transfers_list = self.scenario._list_transfers()
|
||||
self.assertEqual(
|
||||
self.clients("cinder").transfers.list.return_value,
|
||||
return_transfers_list)
|
||||
self._test_atomic_action_timer(self.scenario.atomic_actions(),
|
||||
"cinder.list_transfers")
|
||||
|
||||
def test__set_metadata(self):
|
||||
volume = fakes.FakeVolume()
|
||||
|
||||
|
@ -60,6 +60,12 @@ class CinderServersTestCase(test.ScenarioTestCase):
|
||||
scenario.run(None, None)
|
||||
scenario._list_types.assert_called_once_with(None, None)
|
||||
|
||||
def test_list_transfers(self):
|
||||
scenario = volumes.ListTransfers(self.context)
|
||||
scenario._list_transfers = mock.MagicMock()
|
||||
scenario.run(True, None)
|
||||
scenario._list_transfers.assert_called_once_with(True, None)
|
||||
|
||||
def test_create_and_update_volume(self):
|
||||
volume_update_args = {"dispaly_name": "_updated"}
|
||||
scenario = volumes.CreateAndUpdateVolume(self.context)
|
||||
|
Loading…
Reference in New Issue
Block a user