[Manila] Add create_and_list_share scenario for Manila

Add 'create_and_list_share' scenario and task samples and update manila
tasks for CI.

Change-Id: I9317e40f8f62eb84d26833f7efbe32337cdfb770
This commit is contained in:
Valeriy Ponomaryov 2015-06-12 18:49:31 +03:00
parent 449bfcb4e2
commit 57fa652a98
8 changed files with 230 additions and 3 deletions

View File

@ -33,7 +33,8 @@
failure_rate:
max: 0
ManilaShares.create_and_delete_share:
{% for s in ("create_and_delete_share", "create_and_list_share") %}
ManilaShares.{{s}}:
-
args:
share_proto: "nfs"
@ -55,3 +56,4 @@
sla:
failure_rate:
max: 0
{% endfor %}

View File

@ -34,7 +34,8 @@
failure_rate:
max: 0
ManilaShares.create_and_delete_share:
{% for s in ("create_and_delete_share", "create_and_list_share") %}
ManilaShares.{{s}}:
-
args:
share_proto: "nfs"
@ -63,6 +64,7 @@
sla:
failure_rate:
max: 0
{% endfor %}
ManilaShares.create_share_network_and_delete:
-

View File

@ -198,4 +198,33 @@ class AttachSecurityServiceToShareNetwork(utils.ManilaScenario):
sn = self._create_share_network()
ss = self._create_security_service(
security_service_type=security_service_type)
self._add_security_service_to_share_network(sn, ss)
self._add_security_service_to_share_network(sn, ss)
@validation.validate_share_proto()
@validation.required_services(consts.Service.MANILA)
@validation.required_openstack(users=True)
@scenario.configure(
context={"cleanup": ["manila"]},
name=("ManilaShares.create_and_list_share"))
class CreateAndListShare(utils.ManilaScenario):
def run(self, share_proto, size=1, min_sleep=0, max_sleep=0, detailed=True,
**kwargs):
"""Create a share and list all shares.
Optional 'min_sleep' and 'max_sleep' parameters allow the scenario
to simulate a pause between share creation and list
(of random duration from [min_sleep, max_sleep]).
:param share_proto: share protocol, valid values are NFS, CIFS,
GlusterFS and HDFS
:param size: share size in GB, should be greater than 0
:param min_sleep: minimum sleep time in seconds (non-negative)
:param max_sleep: maximum sleep time in seconds (non-negative)
:param detailed: defines whether to get detailed list of shares or not
:param kwargs: optional args to create a share
"""
self._create_share(share_proto=share_proto, size=size, **kwargs)
self.sleep_between(min_sleep, max_sleep)
self._list_shares(detailed=detailed)

View File

@ -0,0 +1,66 @@
{% set use_security_services = use_security_services or False %}
{
"ManilaShares.create_and_list_share": [
{
"args": {
"share_proto": "nfs",
"size": 1,
"min_sleep": 1,
"max_sleep": 2
},
"runner": {
"type": "constant",
"times": 2,
"concurrency": 2
},
"context": {
"quotas": {
"manila": {
"shares": -1,
"gigabytes": -1,
"share_networks": -1
}
},
"users": {
"tenants": 2,
"users_per_tenant": 1,
"user_choice_method": "round_robin"
},
"network": {
"networks_per_tenant": 1,
"start_cidr": "99.0.0.0/24"
},
"manila_share_networks": {
"use_share_networks": true
}
{% if use_security_services %}
,
"manila_security_services": {
"security_services": [
{"security_service_type": "ldap",
"server": "LDAP server address",
"user": "User that will be used",
"password": "Password for specified user"},
{"security_service_type": "kerberos",
"dns_ip": "IP address of DNS service to be used",
"server": "Kerberos server address",
"domain": "Kerberos realm",
"user": "User that will be used",
"password": "Password for specified user"},
{"security_service_type": "active_directory",
"dns_ip": "IP address of DNS service to be used",
"domain": "Domain from 'Active Directory'",
"user": "User from 'Active Directory'",
"password": "password for specified user"}
]
}
{% endif %}
},
"sla": {
"failure_rate": {
"max": 0
}
}
}
]
}

View File

@ -0,0 +1,51 @@
{% set use_security_services = use_security_services or False %}
---
ManilaShares.create_and_list_share:
-
args:
share_proto: "nfs"
size: 1
min_sleep: 1
max_sleep: 2
runner:
type: "constant"
times: 2
concurrency: 2
context:
quotas:
manila:
shares: -1
gigabytes: -1
share_networks: -1
users:
tenants: 2
users_per_tenant: 1
user_choice_method: "round_robin"
network:
networks_per_tenant: 1
start_cidr: "99.0.0.0/24"
manila_share_networks:
use_share_networks: True
{% if use_security_services %}
manila_security_services:
security_services: [
{"security_service_type": "ldap",
"server": "LDAP server address",
"user": "User that will be used",
"password": "Password for specified user"},
{"security_service_type": "kerberos",
"dns_ip": "IP address of DNS service to be used",
"server": "Kerberos server address",
"domain": "Kerberos realm",
"user": "User that will be used",
"password": "Password for specified user"},
{"security_service_type": "active_directory",
"dns_ip": "IP address of DNS service to be used",
"domain": "Domain from 'Active Directory'",
"user": "User from 'Active Directory'",
"password": "password for specified user"},
]
{% endif %}
sla:
failure_rate:
max: 0

View File

@ -0,0 +1,35 @@
{
"ManilaShares.create_and_list_share": [
{
"args": {
"share_proto": "nfs",
"size": 1,
"min_sleep": 1,
"max_sleep": 2
},
"runner": {
"type": "constant",
"times": 2,
"concurrency": 2
},
"context": {
"quotas": {
"manila": {
"shares": -1,
"gigabytes": -1
}
},
"users": {
"tenants": 2,
"users_per_tenant": 1,
"user_choice_method": "round_robin"
}
},
"sla": {
"failure_rate": {
"max": 0
}
}
}
]
}

View File

@ -0,0 +1,24 @@
---
ManilaShares.create_and_list_share:
-
args:
share_proto: "nfs"
size: 1
min_sleep: 1
max_sleep: 2
runner:
type: "constant"
times: 2
concurrency: 2
context:
quotas:
manila:
shares: -1
gigabytes: -1
users:
tenants: 2
users_per_tenant: 1
user_choice_method: "round_robin"
sla:
failure_rate:
max: 0

View File

@ -191,3 +191,21 @@ class ManilaSharesTestCase(test.ScenarioTestCase):
scenario._add_security_service_to_share_network.assert_has_calls([
mock.call(scenario._create_share_network.return_value,
scenario._create_security_service.return_value)])
@ddt.data(
{"share_proto": "nfs", "size": 3, "detailed": True},
{"share_proto": "cifs", "size": 4, "detailed": False,
"share_network": "foo", "share_type": "bar"},
)
def test_create_and_list_share(self, params):
scenario = shares.CreateAndListShare()
scenario._create_share = mock.MagicMock()
scenario.sleep_between = mock.MagicMock()
scenario._list_shares = mock.MagicMock()
scenario.run(min_sleep=3, max_sleep=4, **params)
detailed = params.pop("detailed")
scenario._create_share.assert_called_once_with(**params)
scenario.sleep_between.assert_called_once_with(3, 4)
scenario._list_shares.assert_called_once_with(detailed=detailed)