Make scenario tests able to run with DHSS=False
Change Manila tempest scenario tests to be able to work with drivers in 'driver_handles_share_servers = False' mode. Closes-bug: #1483686 Change-Id: Iefa6718e8b537468e5f4f9ce50cccdf0cafe737d
This commit is contained in:
parent
94e62e1a41
commit
d459e76fdc
@ -163,4 +163,7 @@ ShareGroup = [
|
|||||||
default=1200,
|
default=1200,
|
||||||
help="Time to wait for share migration before "
|
help="Time to wait for share migration before "
|
||||||
"timing out (seconds)."),
|
"timing out (seconds)."),
|
||||||
|
cfg.StrOpt("default_share_type_name",
|
||||||
|
default=None,
|
||||||
|
help="Default share type name to use in tempest tests."),
|
||||||
]
|
]
|
||||||
|
@ -64,7 +64,10 @@ class ShareScenarioTest(manager.NetworkScenarioTest):
|
|||||||
description = description or "Tempest's share"
|
description = description or "Tempest's share"
|
||||||
if not name:
|
if not name:
|
||||||
name = data_utils.rand_name("manila-scenario")
|
name = data_utils.rand_name("manila-scenario")
|
||||||
share_network_id = share_network_id or client.share_network_id or None
|
if CONF.share.multitenancy_enabled:
|
||||||
|
share_network_id = (share_network_id or client.share_network_id)
|
||||||
|
else:
|
||||||
|
share_network_id = None
|
||||||
metadata = metadata or {}
|
metadata = metadata or {}
|
||||||
kwargs = {
|
kwargs = {
|
||||||
'share_protocol': share_protocol,
|
'share_protocol': share_protocol,
|
||||||
@ -190,3 +193,11 @@ class ShareScenarioTest(manager.NetworkScenarioTest):
|
|||||||
client.migrate_share(share_id, dest_host)
|
client.migrate_share(share_id, dest_host)
|
||||||
share = client.wait_for_migration_completed(share_id, dest_host)
|
share = client.wait_for_migration_completed(share_id, dest_host)
|
||||||
return share
|
return share
|
||||||
|
|
||||||
|
def _create_share_type(self, name, is_public=True, **kwargs):
|
||||||
|
share_type = self.shares_admin_v2_client.create_share_type(name,
|
||||||
|
is_public,
|
||||||
|
**kwargs)
|
||||||
|
self.addCleanup(self.shares_admin_v2_client.delete_share_type,
|
||||||
|
share_type['share_type']['id'])
|
||||||
|
return share_type
|
||||||
|
@ -62,16 +62,15 @@ class ShareBasicOpsBase(manager.ShareScenarioTest):
|
|||||||
image=self.image_ref, flavor=self.flavor_ref,
|
image=self.image_ref, flavor=self.flavor_ref,
|
||||||
ssh_user=self.ssh_user))
|
ssh_user=self.ssh_user))
|
||||||
|
|
||||||
def boot_instance(self, network):
|
def boot_instance(self):
|
||||||
self.keypair = self.create_keypair()
|
self.keypair = self.create_keypair()
|
||||||
security_groups = [{'name': self.security_group['name']}]
|
security_groups = [{'name': self.security_group['name']}]
|
||||||
create_kwargs = {
|
create_kwargs = {
|
||||||
'networks': [
|
|
||||||
{'uuid': network['id']},
|
|
||||||
],
|
|
||||||
'key_name': self.keypair['name'],
|
'key_name': self.keypair['name'],
|
||||||
'security_groups': security_groups,
|
'security_groups': security_groups,
|
||||||
}
|
}
|
||||||
|
if CONF.share.multitenancy_enabled:
|
||||||
|
create_kwargs['networks'] = [{'uuid': self.net['id']}, ]
|
||||||
instance = self.create_server(image=self.image_ref,
|
instance = self.create_server(image=self.image_ref,
|
||||||
create_kwargs=create_kwargs,
|
create_kwargs=create_kwargs,
|
||||||
flavor=self.flavor_ref)
|
flavor=self.flavor_ref)
|
||||||
@ -133,9 +132,25 @@ class ShareBasicOpsBase(manager.ShareScenarioTest):
|
|||||||
neutron_subnet_id=self.subnet['id'],
|
neutron_subnet_id=self.subnet['id'],
|
||||||
name=data_utils.rand_name("sn-name"))
|
name=data_utils.rand_name("sn-name"))
|
||||||
|
|
||||||
def create_share(self, share_net_id):
|
def _get_share_type(self):
|
||||||
self.share = self._create_share(share_protocol=self.protocol,
|
if CONF.share.default_share_type_name:
|
||||||
share_network_id=share_net_id)
|
return self.shares_client.get_share_type(
|
||||||
|
CONF.share.default_share_type_name)['share_type']
|
||||||
|
return self._create_share_type(
|
||||||
|
data_utils.rand_name("share_type"),
|
||||||
|
extra_specs={
|
||||||
|
'driver_handles_share_servers': CONF.share.multitenancy_enabled
|
||||||
|
},)['share_type']
|
||||||
|
|
||||||
|
def create_share(self):
|
||||||
|
kwargs = {
|
||||||
|
'share_protocol': self.protocol,
|
||||||
|
'share_type_id': self._get_share_type()['id'],
|
||||||
|
}
|
||||||
|
if CONF.share.multitenancy_enabled:
|
||||||
|
self.create_share_network()
|
||||||
|
kwargs.update({'share_network_id': self.share_net['id']})
|
||||||
|
self.share = self._create_share(**kwargs)
|
||||||
|
|
||||||
def allow_access_ip(self, share_id, ip=None, instance=None, cleanup=True):
|
def allow_access_ip(self, share_id, ip=None, instance=None, cleanup=True):
|
||||||
if instance and not ip:
|
if instance and not ip:
|
||||||
@ -155,9 +170,8 @@ class ShareBasicOpsBase(manager.ShareScenarioTest):
|
|||||||
@test.services('compute', 'network')
|
@test.services('compute', 'network')
|
||||||
def test_mount_share_one_vm(self):
|
def test_mount_share_one_vm(self):
|
||||||
self.security_group = self._create_security_group()
|
self.security_group = self._create_security_group()
|
||||||
self.create_share_network()
|
self.create_share()
|
||||||
self.create_share(self.share_net['id'])
|
instance = self.boot_instance()
|
||||||
instance = self.boot_instance(self.net)
|
|
||||||
self.allow_access_ip(self.share['id'], instance=instance)
|
self.allow_access_ip(self.share['id'], instance=instance)
|
||||||
ssh_client = self.init_ssh(instance)
|
ssh_client = self.init_ssh(instance)
|
||||||
for location in self.share['export_locations']:
|
for location in self.share['export_locations']:
|
||||||
@ -170,11 +184,10 @@ class ShareBasicOpsBase(manager.ShareScenarioTest):
|
|||||||
"""Boots two vms and writes/reads data on it."""
|
"""Boots two vms and writes/reads data on it."""
|
||||||
test_data = "Some test data to write"
|
test_data = "Some test data to write"
|
||||||
self.security_group = self._create_security_group()
|
self.security_group = self._create_security_group()
|
||||||
self.create_share_network()
|
self.create_share()
|
||||||
self.create_share(self.share_net['id'])
|
|
||||||
|
|
||||||
# boot first VM and write data
|
# boot first VM and write data
|
||||||
instance1 = self.boot_instance(self.net)
|
instance1 = self.boot_instance()
|
||||||
self.allow_access_ip(self.share['id'], instance=instance1)
|
self.allow_access_ip(self.share['id'], instance=instance1)
|
||||||
ssh_client_inst1 = self.init_ssh(instance1)
|
ssh_client_inst1 = self.init_ssh(instance1)
|
||||||
first_location = self.share['export_locations'][0]
|
first_location = self.share['export_locations'][0]
|
||||||
@ -184,7 +197,7 @@ class ShareBasicOpsBase(manager.ShareScenarioTest):
|
|||||||
self.write_data(test_data, ssh_client_inst1)
|
self.write_data(test_data, ssh_client_inst1)
|
||||||
|
|
||||||
# boot second VM and read
|
# boot second VM and read
|
||||||
instance2 = self.boot_instance(self.net)
|
instance2 = self.boot_instance()
|
||||||
self.allow_access_ip(self.share['id'], instance=instance2)
|
self.allow_access_ip(self.share['id'], instance=instance2)
|
||||||
ssh_client_inst2 = self.init_ssh(instance2)
|
ssh_client_inst2 = self.init_ssh(instance2)
|
||||||
self.mount_share(first_location, ssh_client_inst2)
|
self.mount_share(first_location, ssh_client_inst2)
|
||||||
@ -211,8 +224,7 @@ class ShareBasicOpsBase(manager.ShareScenarioTest):
|
|||||||
"Skipping.")
|
"Skipping.")
|
||||||
|
|
||||||
self.security_group = self._create_security_group()
|
self.security_group = self._create_security_group()
|
||||||
self.create_share_network()
|
self.create_share()
|
||||||
self.create_share(self.share_net['id'])
|
|
||||||
share = self.shares_client.get_share(self.share['id'])
|
share = self.shares_client.get_share(self.share['id'])
|
||||||
|
|
||||||
dest_pool = next((x for x in pools if x['name'] != share['host']),
|
dest_pool = next((x for x in pools if x['name'] != share['host']),
|
||||||
@ -225,7 +237,7 @@ class ShareBasicOpsBase(manager.ShareScenarioTest):
|
|||||||
|
|
||||||
old_export_location = share['export_locations'][0]
|
old_export_location = share['export_locations'][0]
|
||||||
|
|
||||||
instance1 = self.boot_instance(self.net)
|
instance1 = self.boot_instance()
|
||||||
self.allow_access_ip(self.share['id'], instance=instance1,
|
self.allow_access_ip(self.share['id'], instance=instance1,
|
||||||
cleanup=False)
|
cleanup=False)
|
||||||
ssh_client = self.init_ssh(instance1)
|
ssh_client = self.init_ssh(instance1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user