[Manila] Add scenario for creation/deletion of Manila share networks
List of changes: - Added support of 'create' and 'delete' operations for share networks. - Added benchmark for creating and deleting share networks. Change-Id: I25ffb2d8d769f6d81972f8773951246f11abb2a0
This commit is contained in:
parent
4f4888721f
commit
0b9b15f640
@ -32,3 +32,22 @@
|
|||||||
sla:
|
sla:
|
||||||
failure_rate:
|
failure_rate:
|
||||||
max: 0
|
max: 0
|
||||||
|
|
||||||
|
ManilaShares.create_share_network_and_delete:
|
||||||
|
-
|
||||||
|
args:
|
||||||
|
name: "rally"
|
||||||
|
runner:
|
||||||
|
type: "constant"
|
||||||
|
times: 10
|
||||||
|
concurrency: 10
|
||||||
|
context:
|
||||||
|
quotas:
|
||||||
|
manila:
|
||||||
|
share_networks: -1
|
||||||
|
users:
|
||||||
|
tenants: 2
|
||||||
|
users_per_tenant: 1
|
||||||
|
sla:
|
||||||
|
failure_rate:
|
||||||
|
max: 0
|
||||||
|
@ -60,3 +60,29 @@ class ManilaShares(utils.ManilaScenario):
|
|||||||
"name", "host", "share_type", etc.
|
"name", "host", "share_type", etc.
|
||||||
"""
|
"""
|
||||||
self._list_shares(detailed=detailed, search_opts=search_opts)
|
self._list_shares(detailed=detailed, search_opts=search_opts)
|
||||||
|
|
||||||
|
@validation.required_services(consts.Service.MANILA)
|
||||||
|
@validation.required_openstack(users=True)
|
||||||
|
@base.scenario(context={"cleanup": ["manila"]})
|
||||||
|
def create_share_network_and_delete(self,
|
||||||
|
neutron_net_id=None,
|
||||||
|
neutron_subnet_id=None,
|
||||||
|
nova_net_id=None,
|
||||||
|
name=None,
|
||||||
|
description=None):
|
||||||
|
"""Creates share network and then deletes.
|
||||||
|
|
||||||
|
:param neutron_net_id: ID of Neutron network
|
||||||
|
:param neutron_subnet_id: ID of Neutron subnet
|
||||||
|
:param nova_net_id: ID of Nova network
|
||||||
|
:param name: share network name
|
||||||
|
:param description: share network description
|
||||||
|
"""
|
||||||
|
share_network = self._create_share_network(
|
||||||
|
neutron_net_id=neutron_net_id,
|
||||||
|
neutron_subnet_id=neutron_subnet_id,
|
||||||
|
nova_net_id=nova_net_id,
|
||||||
|
name=name,
|
||||||
|
description=description,
|
||||||
|
)
|
||||||
|
self._delete_share_network(share_network)
|
||||||
|
@ -111,3 +111,38 @@ class ManilaScenario(base.Scenario):
|
|||||||
"""
|
"""
|
||||||
return self.clients("manila").shares.list(
|
return self.clients("manila").shares.list(
|
||||||
detailed=detailed, search_opts=search_opts)
|
detailed=detailed, search_opts=search_opts)
|
||||||
|
|
||||||
|
@base.atomic_action_timer("manila.create_share_network")
|
||||||
|
def _create_share_network(self, neutron_net_id=None,
|
||||||
|
neutron_subnet_id=None,
|
||||||
|
nova_net_id=None, name=None, description=None):
|
||||||
|
"""Create share network.
|
||||||
|
|
||||||
|
:param neutron_net_id: ID of Neutron network
|
||||||
|
:param neutron_subnet_id: ID of Neutron subnet
|
||||||
|
:param nova_net_id: ID of Nova network
|
||||||
|
:param name: share network name
|
||||||
|
:param description: share network description
|
||||||
|
:returns: instance of :class:`ShareNetwork`
|
||||||
|
"""
|
||||||
|
name = name or self._generate_random_name()
|
||||||
|
share_network = self.clients("manila").share_networks.create(
|
||||||
|
neutron_net_id=neutron_net_id,
|
||||||
|
neutron_subnet_id=neutron_subnet_id,
|
||||||
|
nova_net_id=nova_net_id,
|
||||||
|
name=name,
|
||||||
|
description=description)
|
||||||
|
return share_network
|
||||||
|
|
||||||
|
@base.atomic_action_timer("manila.delete_share_network")
|
||||||
|
def _delete_share_network(self, share_network):
|
||||||
|
"""Delete share network.
|
||||||
|
|
||||||
|
:param share_network: instance of :class:`ShareNetwork`.
|
||||||
|
"""
|
||||||
|
share_network.delete()
|
||||||
|
bench_utils.wait_for_delete(
|
||||||
|
share_network,
|
||||||
|
update_resource=bench_utils.get_from_manager(),
|
||||||
|
timeout=CONF.benchmark.manila_share_delete_timeout,
|
||||||
|
check_interval=CONF.benchmark.manila_share_delete_poll_interval)
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"ManilaShares.create_share_network_and_delete": [
|
||||||
|
{
|
||||||
|
"args": {
|
||||||
|
"name": "rally"
|
||||||
|
},
|
||||||
|
"runner": {
|
||||||
|
"type": "constant",
|
||||||
|
"times": 10,
|
||||||
|
"concurrency": 10
|
||||||
|
},
|
||||||
|
"context": {
|
||||||
|
"quotas": {
|
||||||
|
"manila": {
|
||||||
|
"share_networks": -1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"users": {
|
||||||
|
"tenants": 2,
|
||||||
|
"users_per_tenant": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
---
|
||||||
|
ManilaShares.create_share_network_and_delete:
|
||||||
|
-
|
||||||
|
args:
|
||||||
|
name: "rally"
|
||||||
|
runner:
|
||||||
|
type: "constant"
|
||||||
|
times: 10
|
||||||
|
concurrency: 10
|
||||||
|
context:
|
||||||
|
quotas:
|
||||||
|
manila:
|
||||||
|
share_networks: -1
|
||||||
|
users:
|
||||||
|
tenants: 2
|
||||||
|
users_per_tenant: 1
|
@ -62,3 +62,36 @@ class ManilaSharesTestCase(test.TestCase):
|
|||||||
|
|
||||||
scenario._list_shares.assert_called_once_with(
|
scenario._list_shares.assert_called_once_with(
|
||||||
detailed=detailed, search_opts=search_opts)
|
detailed=detailed, search_opts=search_opts)
|
||||||
|
|
||||||
|
@ddt.data(
|
||||||
|
{},
|
||||||
|
{"name": "foo_name"},
|
||||||
|
{"description": "foo_description"},
|
||||||
|
{"neutron_net_id": "foo_neutron_net_id"},
|
||||||
|
{"neutron_subnet_id": "foo_neutron_subnet_id"},
|
||||||
|
{"nova_net_id": "foo_nova_net_id"},
|
||||||
|
{"name": "foo_name",
|
||||||
|
"description": "foo_description",
|
||||||
|
"neutron_net_id": "foo_neutron_net_id",
|
||||||
|
"neutron_subnet_id": "foo_neutron_subnet_id",
|
||||||
|
"nova_net_id": "foo_nova_net_id"},
|
||||||
|
)
|
||||||
|
def test_create_share_network_and_delete(self, params):
|
||||||
|
fake_sn = mock.MagicMock()
|
||||||
|
scenario = shares.ManilaShares()
|
||||||
|
scenario._create_share_network = mock.MagicMock(return_value=fake_sn)
|
||||||
|
scenario._delete_share_network = mock.MagicMock()
|
||||||
|
expected_params = {
|
||||||
|
"name": None,
|
||||||
|
"description": None,
|
||||||
|
"neutron_net_id": None,
|
||||||
|
"neutron_subnet_id": None,
|
||||||
|
"nova_net_id": None,
|
||||||
|
}
|
||||||
|
expected_params.update(params)
|
||||||
|
|
||||||
|
scenario.create_share_network_and_delete(**params)
|
||||||
|
|
||||||
|
scenario._create_share_network.assert_called_once_with(
|
||||||
|
**expected_params)
|
||||||
|
scenario._delete_share_network.assert_called_once_with(fake_sn)
|
||||||
|
@ -81,3 +81,35 @@ class ManilaScenarioTestCase(test.ClientsTestCase):
|
|||||||
self.clients("manila").shares.list.assert_called_once_with(
|
self.clients("manila").shares.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(None, "", "SomeName")
|
||||||
|
def test__create_share_network(self, name):
|
||||||
|
fake_sn = mock.Mock()
|
||||||
|
self.scenario._generate_random_name = mock.Mock()
|
||||||
|
self.clients("manila").share_networks.create.return_value = fake_sn
|
||||||
|
data = {
|
||||||
|
"neutron_net_id": "fake_neutron_net_id",
|
||||||
|
"neutron_subnet_id": "fake_neutron_subnet_id",
|
||||||
|
"nova_net_id": "fake_nova_net_id",
|
||||||
|
"name": name or self.scenario._generate_random_name.return_value,
|
||||||
|
"description": "fake_description",
|
||||||
|
}
|
||||||
|
|
||||||
|
result = self.scenario._create_share_network(**data)
|
||||||
|
|
||||||
|
self.assertEqual(fake_sn, result)
|
||||||
|
self.clients("manila").share_networks.create.assert_called_once_with(
|
||||||
|
**data)
|
||||||
|
|
||||||
|
@mock.patch(BM_UTILS + "get_from_manager")
|
||||||
|
@mock.patch(BM_UTILS + "wait_for_delete")
|
||||||
|
def test__delete_share_network(self, mock_wait_for_delete,
|
||||||
|
mock_get_from_manager):
|
||||||
|
fake_sn = mock.MagicMock()
|
||||||
|
|
||||||
|
self.scenario._delete_share_network(fake_sn)
|
||||||
|
|
||||||
|
fake_sn.delete.assert_called_once_with()
|
||||||
|
mock_get_from_manager.assert_called_once_with()
|
||||||
|
mock_wait_for_delete.assert_called_once_with(
|
||||||
|
fake_sn, update_resource=mock.ANY, timeout=180, check_interval=2)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user