Add manila extend/shrink scenarios
Change-Id: I61e6e5f1ccadd48cfd964a9115968e48afecb150
This commit is contained in:
parent
06cd90e39c
commit
665da97572
@ -59,6 +59,51 @@
|
||||
max: 0
|
||||
{% endfor %}
|
||||
|
||||
ManilaShares.create_and_extend_share:
|
||||
-
|
||||
args:
|
||||
share_proto: "nfs"
|
||||
size: 1
|
||||
share_type: "dhss_false"
|
||||
new_size: 2
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 4
|
||||
concurrency: 4
|
||||
context:
|
||||
quotas:
|
||||
manila:
|
||||
shares: -1
|
||||
gigabytes: -1
|
||||
users:
|
||||
tenants: 2
|
||||
users_per_tenant: 1
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 0
|
||||
|
||||
ManilaShares.create_and_shrink_share:
|
||||
-
|
||||
args:
|
||||
share_proto: "nfs"
|
||||
size: 2
|
||||
share_type: "dhss_false"
|
||||
new_size: 1
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 4
|
||||
concurrency: 4
|
||||
context:
|
||||
quotas:
|
||||
manila:
|
||||
shares: -1
|
||||
gigabytes: -1
|
||||
users:
|
||||
tenants: 2
|
||||
users_per_tenant: 1
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 0
|
||||
|
||||
ManilaShares.set_and_delete_metadata:
|
||||
-
|
||||
|
@ -34,6 +34,60 @@
|
||||
failure_rate:
|
||||
max: 0
|
||||
|
||||
ManilaShares.create_and_extend_share:
|
||||
-
|
||||
args:
|
||||
share_proto: "nfs"
|
||||
size: 1
|
||||
new_size: 2
|
||||
share_type: "dhss_true"
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 4
|
||||
concurrency: 4
|
||||
context:
|
||||
quotas:
|
||||
manila:
|
||||
shares: -1
|
||||
gigabytes: -1
|
||||
share_networks: -1
|
||||
users:
|
||||
tenants: 2
|
||||
users_per_tenant: 1
|
||||
user_choice_method: "round_robin"
|
||||
manila_share_networks:
|
||||
use_share_networks: True
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 0
|
||||
|
||||
ManilaShares.create_and_shrink_share:
|
||||
-
|
||||
args:
|
||||
share_proto: "nfs"
|
||||
size: 2
|
||||
new_size: 1
|
||||
share_type: "dhss_true"
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 4
|
||||
concurrency: 4
|
||||
context:
|
||||
quotas:
|
||||
manila:
|
||||
shares: -1
|
||||
gigabytes: -1
|
||||
share_networks: -1
|
||||
users:
|
||||
tenants: 2
|
||||
users_per_tenant: 1
|
||||
user_choice_method: "round_robin"
|
||||
manila_share_networks:
|
||||
use_share_networks: True
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 0
|
||||
|
||||
{% for s in ("create_and_delete_share", "create_and_list_share") %}
|
||||
ManilaShares.{{s}}:
|
||||
-
|
||||
|
@ -69,6 +69,92 @@ class ListShares(utils.ManilaScenario):
|
||||
self._list_shares(detailed=detailed, search_opts=search_opts)
|
||||
|
||||
|
||||
@validation.add("enum", param_name="share_proto", values=["nfs", "cephfs"
|
||||
"cifs", "glusterfs", "hdfs"], missed=False,
|
||||
case_insensitive=True)
|
||||
@validation.add("required_services", services=[consts.Service.MANILA])
|
||||
@validation.add("required_platform", platform="openstack", users=True)
|
||||
@scenario.configure(context={"cleanup": ["manila"]},
|
||||
name="ManilaShares.create_and_extend_share")
|
||||
class CreateAndExtendShare(utils.ManilaScenario):
|
||||
def run(self, share_proto, size=1, new_size=2, snapshot_id=None,
|
||||
description=None, metadata=None, share_network=None,
|
||||
share_type=None, is_public=False, availability_zone=None,
|
||||
share_group_id=None):
|
||||
"""Create and extend a share
|
||||
|
||||
:param share_proto: share protocol for new share
|
||||
available values are NFS, CIFS, CephFS, GlusterFS and HDFS.
|
||||
:param size: size in GiB
|
||||
:param new_size: new size of the share in GiB
|
||||
:param snapshot_id: ID of the snapshot
|
||||
:param description: description of a share
|
||||
:param metadata: optional metadata to set on share creation
|
||||
:param share_network: either instance of ShareNetwork or text with ID
|
||||
:param share_type: either instance of ShareType or text with ID
|
||||
:param is_public: whether to set share as public or not.
|
||||
:param availability_zone: availability zone of the share
|
||||
:param share_group_id: ID of the share group to which the share
|
||||
should belong
|
||||
"""
|
||||
share = self._create_share(
|
||||
share_proto=share_proto,
|
||||
size=size,
|
||||
snapshot_id=snapshot_id,
|
||||
description=description,
|
||||
metadata=metadata,
|
||||
share_network=share_network,
|
||||
share_type=share_type,
|
||||
is_public=is_public,
|
||||
availability_zone=availability_zone,
|
||||
share_group_id=share_group_id
|
||||
)
|
||||
self._extend_share(share, new_size)
|
||||
|
||||
|
||||
@validation.add("enum", param_name="share_proto", values=["nfs", "cephfs"
|
||||
"cifs", "glusterfs", "hdfs"], missed=False,
|
||||
case_insensitive=True)
|
||||
@validation.add("required_services", services=[consts.Service.MANILA])
|
||||
@validation.add("required_platform", platform="openstack", users=True)
|
||||
@scenario.configure(context={"cleanup": ["manila"]},
|
||||
name="ManilaShares.create_and_shrink_share")
|
||||
class CreateAndShrinkShare(utils.ManilaScenario):
|
||||
def run(self, share_proto, size=2, new_size=1, snapshot_id=None,
|
||||
description=None, metadata=None, share_network=None,
|
||||
share_type=None, is_public=False, availability_zone=None,
|
||||
share_group_id=None):
|
||||
"""Create and shrink a share
|
||||
|
||||
:param share_proto: share protocol for new share
|
||||
available values are NFS, CIFS, CephFS, GlusterFS and HDFS.
|
||||
:param size: size in GiB
|
||||
:param new_size: new size of the share in GiB
|
||||
:param snapshot_id: ID of the snapshot
|
||||
:param description: description of a share
|
||||
:param metadata: optional metadata to set on share creation
|
||||
:param share_network: either instance of ShareNetwork or text with ID
|
||||
:param share_type: either instance of ShareType or text with ID
|
||||
:param is_public: whether to set share as public or not.
|
||||
:param availability_zone: availability zone of the share
|
||||
:param share_group_id: ID of the share group to which the share
|
||||
should belong
|
||||
"""
|
||||
share = self._create_share(
|
||||
share_proto=share_proto,
|
||||
size=size,
|
||||
snapshot_id=snapshot_id,
|
||||
description=description,
|
||||
metadata=metadata,
|
||||
share_network=share_network,
|
||||
share_type=share_type,
|
||||
is_public=is_public,
|
||||
availability_zone=availability_zone,
|
||||
share_group_id=share_group_id
|
||||
)
|
||||
self._shrink_share(share, new_size)
|
||||
|
||||
|
||||
@validation.add("required_services", services=[consts.Service.MANILA])
|
||||
@validation.add("required_platform", platform="openstack", users=True)
|
||||
@scenario.configure(context={"cleanup": ["manila"]},
|
||||
|
@ -98,6 +98,36 @@ class ManilaScenario(scenario.OpenStackScenario):
|
||||
return self.clients("manila").shares.list(
|
||||
detailed=detailed, search_opts=search_opts)
|
||||
|
||||
@atomic.action_timer("manila.extend_share")
|
||||
def _extend_share(self, share, new_size):
|
||||
"""Extend the given share
|
||||
|
||||
:param share: :class:`Share`
|
||||
:param new_size: new size of the share
|
||||
"""
|
||||
share.extend(new_size)
|
||||
utils.wait_for_status(
|
||||
share,
|
||||
ready_statuses=["available"],
|
||||
update_resource=utils.get_from_manager(),
|
||||
timeout=CONF.benchmark.manila_share_create_timeout,
|
||||
check_interval=CONF.benchmark.manila_share_create_poll_interval)
|
||||
|
||||
@atomic.action_timer("manila.shrink_share")
|
||||
def _shrink_share(self, share, new_size):
|
||||
"""Shrink the given share
|
||||
|
||||
:param share: :class:`Share`
|
||||
:param new_size: new size of the share
|
||||
"""
|
||||
share.shrink(new_size)
|
||||
utils.wait_for_status(
|
||||
share,
|
||||
ready_statuses=["available"],
|
||||
update_resource=utils.get_from_manager(),
|
||||
timeout=CONF.benchmark.manila_share_create_timeout,
|
||||
check_interval=CONF.benchmark.manila_share_create_poll_interval)
|
||||
|
||||
@atomic.action_timer("manila.create_share_network")
|
||||
def _create_share_network(self, neutron_net_id=None,
|
||||
neutron_subnet_id=None,
|
||||
|
28
samples/tasks/scenarios/manila/create-share-and-extend.json
Normal file
28
samples/tasks/scenarios/manila/create-share-and-extend.json
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"ManilaShares.create_and_extend_share": [
|
||||
{
|
||||
"args": {
|
||||
"share_proto": "nfs",
|
||||
"size": 1,
|
||||
"new_size": 2
|
||||
},
|
||||
"runner": {
|
||||
"type": "constant",
|
||||
"times": 2,
|
||||
"concurrency": 2
|
||||
},
|
||||
"context": {
|
||||
"quotas": {
|
||||
"manila": {
|
||||
"shares": -1,
|
||||
"gigabytes": -1
|
||||
}
|
||||
},
|
||||
"users": {
|
||||
"tenants": 2,
|
||||
"users_per_tenant": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
19
samples/tasks/scenarios/manila/create-share-and-extend.yaml
Normal file
19
samples/tasks/scenarios/manila/create-share-and-extend.yaml
Normal file
@ -0,0 +1,19 @@
|
||||
---
|
||||
ManilaShares.create_and_extend_share:
|
||||
-
|
||||
args:
|
||||
share_proto: "nfs"
|
||||
size: 1
|
||||
new_size: 2
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 2
|
||||
concurrency: 2
|
||||
context:
|
||||
quotas:
|
||||
manila:
|
||||
shares: -1
|
||||
gigabytes: -1
|
||||
users:
|
||||
tenants: 2
|
||||
users_per_tenant: 1
|
28
samples/tasks/scenarios/manila/create-share-and-shrink.json
Normal file
28
samples/tasks/scenarios/manila/create-share-and-shrink.json
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"ManilaShares.create_and_shrink_share": [
|
||||
{
|
||||
"args": {
|
||||
"share_proto": "nfs",
|
||||
"size": 1,
|
||||
"new_size": 2
|
||||
},
|
||||
"runner": {
|
||||
"type": "constant",
|
||||
"times": 2,
|
||||
"concurrency": 2
|
||||
},
|
||||
"context": {
|
||||
"quotas": {
|
||||
"manila": {
|
||||
"shares": -1,
|
||||
"gigabytes": -1
|
||||
}
|
||||
},
|
||||
"users": {
|
||||
"tenants": 2,
|
||||
"users_per_tenant": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
19
samples/tasks/scenarios/manila/create-share-and-shrink.yaml
Normal file
19
samples/tasks/scenarios/manila/create-share-and-shrink.yaml
Normal file
@ -0,0 +1,19 @@
|
||||
---
|
||||
ManilaShares.create_and_shrink_share:
|
||||
-
|
||||
args:
|
||||
share_proto: "nfs"
|
||||
size: 1
|
||||
new_size: 2
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 2
|
||||
concurrency: 2
|
||||
context:
|
||||
quotas:
|
||||
manila:
|
||||
shares: -1
|
||||
gigabytes: -1
|
||||
users:
|
||||
tenants: 2
|
||||
users_per_tenant: 1
|
@ -63,6 +63,112 @@ class ManilaSharesTestCase(test.ScenarioTestCase):
|
||||
scenario._list_shares.assert_called_once_with(
|
||||
detailed=detailed, search_opts=search_opts)
|
||||
|
||||
@ddt.data(
|
||||
{"params": {"share_proto": "nfs"}, "new_size": 4},
|
||||
{
|
||||
"params": {
|
||||
"share_proto": "cifs",
|
||||
"size": 4,
|
||||
"share_network": "foo",
|
||||
"share_type": "bar",
|
||||
"snapshot_id": "snapshot_foo",
|
||||
"description": "foo_description",
|
||||
"metadata": {"foo_metadata": "foo"},
|
||||
"share_network": "foo_network",
|
||||
"share_type": "foo_type",
|
||||
"is_public": True,
|
||||
"availability_zone": "foo_avz",
|
||||
"share_group_id": "foo_group_id"
|
||||
},
|
||||
"new_size": 8
|
||||
}
|
||||
)
|
||||
@ddt.unpack
|
||||
def test_create_and_extend_shares(self, params, new_size):
|
||||
size = params.get("size", 1)
|
||||
share_group_id = params.get("share_group_id", None)
|
||||
snapshot_id = params.get("snapshot_id", None)
|
||||
description = params.get("description", None)
|
||||
metadata = params.get("metadata", None)
|
||||
share_network = params.get("share_network", None)
|
||||
share_type = params.get("share_type", None)
|
||||
is_public = params.get("is_public", False)
|
||||
availability_zone = params.get("availability_zone", None)
|
||||
|
||||
fake_share = mock.MagicMock()
|
||||
scenario = shares.CreateAndExtendShare(self.context)
|
||||
scenario._create_share = mock.MagicMock(return_value=fake_share)
|
||||
scenario._extend_share = mock.MagicMock()
|
||||
|
||||
scenario.run(new_size=new_size, **params)
|
||||
|
||||
scenario._create_share.assert_called_with(
|
||||
share_proto=params["share_proto"],
|
||||
size=size,
|
||||
snapshot_id=snapshot_id,
|
||||
description=description,
|
||||
metadata=metadata,
|
||||
share_network=share_network,
|
||||
share_type=share_type,
|
||||
is_public=is_public,
|
||||
availability_zone=availability_zone,
|
||||
share_group_id=share_group_id
|
||||
)
|
||||
scenario._extend_share.assert_called_with(fake_share, new_size)
|
||||
|
||||
@ddt.data(
|
||||
{"params": {"share_proto": "nfs"}, "new_size": 4},
|
||||
{
|
||||
"params": {
|
||||
"share_proto": "cifs",
|
||||
"size": 4,
|
||||
"share_network": "foo",
|
||||
"share_type": "bar",
|
||||
"snapshot_id": "snapshot_foo",
|
||||
"description": "foo_description",
|
||||
"metadata": {"foo_metadata": "foo"},
|
||||
"share_network": "foo_network",
|
||||
"share_type": "foo_type",
|
||||
"is_public": True,
|
||||
"availability_zone": "foo_avz",
|
||||
"share_group_id": "foo_group_id"
|
||||
},
|
||||
"new_size": 8
|
||||
}
|
||||
)
|
||||
@ddt.unpack
|
||||
def test_create_and_shrink_shares(self, params, new_size):
|
||||
size = params.get("size", 2)
|
||||
share_group_id = params.get("share_group_id", None)
|
||||
snapshot_id = params.get("snapshot_id", None)
|
||||
description = params.get("description", None)
|
||||
metadata = params.get("metadata", None)
|
||||
share_network = params.get("share_network", None)
|
||||
share_type = params.get("share_type", None)
|
||||
is_public = params.get("is_public", False)
|
||||
availability_zone = params.get("availability_zone", None)
|
||||
|
||||
fake_share = mock.MagicMock()
|
||||
scenario = shares.CreateAndShrinkShare(self.context)
|
||||
scenario._create_share = mock.MagicMock(return_value=fake_share)
|
||||
scenario._shrink_share = mock.MagicMock()
|
||||
|
||||
scenario.run(new_size=new_size, **params)
|
||||
|
||||
scenario._create_share.assert_called_with(
|
||||
share_proto=params["share_proto"],
|
||||
size=size,
|
||||
snapshot_id=snapshot_id,
|
||||
description=description,
|
||||
metadata=metadata,
|
||||
share_network=share_network,
|
||||
share_type=share_type,
|
||||
is_public=is_public,
|
||||
availability_zone=availability_zone,
|
||||
share_group_id=share_group_id
|
||||
)
|
||||
scenario._shrink_share.assert_called_with(fake_share, new_size)
|
||||
|
||||
@ddt.data(
|
||||
{},
|
||||
{"description": "foo_description"},
|
||||
|
@ -93,6 +93,42 @@ class ManilaScenarioTestCase(test.ScenarioTestCase):
|
||||
detailed=params.get("detailed", True),
|
||||
search_opts=params.get("search_opts"))
|
||||
|
||||
@ddt.data(
|
||||
{"new_size": 5},
|
||||
{"new_size": 10}
|
||||
)
|
||||
def test__extend_share(self, new_size):
|
||||
fake_share = mock.MagicMock()
|
||||
|
||||
self.scenario._extend_share(fake_share, new_size)
|
||||
|
||||
fake_share.extend.assert_called_with(new_size)
|
||||
|
||||
self.mock_wait_for_status.mock.assert_called_once_with(
|
||||
fake_share,
|
||||
ready_statuses=["available"],
|
||||
update_resource=self.mock_get_from_manager.mock.return_value,
|
||||
timeout=300, check_interval=3)
|
||||
self.mock_get_from_manager.mock.assert_called_once_with()
|
||||
|
||||
@ddt.data(
|
||||
{"new_size": 5},
|
||||
{"new_size": 10}
|
||||
)
|
||||
def test__shrink_share(self, new_size):
|
||||
fake_share = mock.MagicMock()
|
||||
|
||||
self.scenario._shrink_share(fake_share, new_size)
|
||||
|
||||
fake_share.shrink.assert_called_with(new_size)
|
||||
|
||||
self.mock_wait_for_status.mock.assert_called_once_with(
|
||||
fake_share,
|
||||
ready_statuses=["available"],
|
||||
update_resource=self.mock_get_from_manager.mock.return_value,
|
||||
timeout=300, check_interval=3)
|
||||
self.mock_get_from_manager.mock.assert_called_once_with()
|
||||
|
||||
def test__create_share_network(self):
|
||||
fake_sn = mock.Mock()
|
||||
self.scenario.generate_random_name = mock.Mock()
|
||||
|
Loading…
Reference in New Issue
Block a user