Merge "Setup snapshot extra specs only if required"

This commit is contained in:
Zuul 2021-06-06 04:38:49 +00:00 committed by Gerrit Code Review
commit 669c6e7204
33 changed files with 294 additions and 127 deletions

View File

@ -27,7 +27,9 @@ ShareGroup = [
cfg.StrOpt("min_api_microversion", cfg.StrOpt("min_api_microversion",
default="2.0", default="2.0",
help="The minimum api microversion is configured to be the " help="The minimum api microversion is configured to be the "
"value of the minimum microversion supported by Manila."), "value of the minimum microversion supported by Manila. "
"This value is only used to validate the versions "
"response from Manila."),
cfg.StrOpt("max_api_microversion", cfg.StrOpt("max_api_microversion",
default="2.61", default="2.61",
help="The maximum api microversion is configured to be the " help="The maximum api microversion is configured to be the "

View File

@ -36,10 +36,13 @@ class AdminActionsTest(base.BaseSharesAdminTest):
"migration_success", None] "migration_success", None]
cls.bad_status = "error_deleting" cls.bad_status = "error_deleting"
# create share type # create share type
cls.share_type = cls._create_share_type() extra_specs = {}
if CONF.share.capability_snapshot_support:
extra_specs.update({'snapshot_support': True})
cls.share_type = cls._create_share_type(specs=extra_specs)
cls.share_type_id = cls.share_type['id'] cls.share_type_id = cls.share_type['id']
# create share # create share
cls.sh = cls.create_share(share_type_id=cls.share_type_id) cls.share = cls.create_share(share_type_id=cls.share_type_id)
def _reset_resource_available(self, resource_id, resource_type="shares"): def _reset_resource_available(self, resource_id, resource_type="shares"):
self.shares_v2_client.reset_state( self.shares_v2_client.reset_state(
@ -52,17 +55,17 @@ class AdminActionsTest(base.BaseSharesAdminTest):
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND) @tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
@ddt.data("error", "available", "error_deleting", "deleting", "creating") @ddt.data("error", "available", "error_deleting", "deleting", "creating")
def test_reset_share_state(self, status): def test_reset_share_state(self, status):
self.shares_v2_client.reset_state(self.sh["id"], status=status) self.shares_v2_client.reset_state(self.share["id"], status=status)
waiters.wait_for_resource_status(self.shares_v2_client, waiters.wait_for_resource_status(self.shares_v2_client,
self.sh["id"], status) self.share["id"], status)
self.addCleanup(self._reset_resource_available, self.sh["id"]) self.addCleanup(self._reset_resource_available, self.share["id"])
@decorators.idempotent_id('13075b2d-fe83-41bf-b6ef-99cfcc00257d') @decorators.idempotent_id('13075b2d-fe83-41bf-b6ef-99cfcc00257d')
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND) @tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
@ddt.data("error", "available", "error_deleting", "deleting", "creating") @ddt.data("error", "available", "error_deleting", "deleting", "creating")
def test_reset_share_instance_state(self, status): def test_reset_share_instance_state(self, status):
sh_instance = self.shares_v2_client.get_instances_of_share( sh_instance = self.shares_v2_client.get_instances_of_share(
self.sh["id"])[0] self.share["id"])[0]
share_instance_id = sh_instance["id"] share_instance_id = sh_instance["id"]
self.shares_v2_client.reset_state( self.shares_v2_client.reset_state(
share_instance_id, s_type="share_instances", status=status) share_instance_id, s_type="share_instances", status=status)
@ -78,7 +81,7 @@ class AdminActionsTest(base.BaseSharesAdminTest):
"Snapshot tests are disabled.") "Snapshot tests are disabled.")
@ddt.data("error", "available", "error_deleting", "deleting", "creating") @ddt.data("error", "available", "error_deleting", "deleting", "creating")
def test_reset_snapshot_state(self, status): def test_reset_snapshot_state(self, status):
snapshot = self.create_snapshot_wait_for_active(self.sh["id"]) snapshot = self.create_snapshot_wait_for_active(self.share["id"])
self.shares_v2_client.reset_state( self.shares_v2_client.reset_state(
snapshot["id"], s_type="snapshots", status=status) snapshot["id"], s_type="snapshots", status=status)
waiters.wait_for_resource_status( waiters.wait_for_resource_status(
@ -133,7 +136,7 @@ class AdminActionsTest(base.BaseSharesAdminTest):
@testtools.skipUnless(CONF.share.run_snapshot_tests, @testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.") "Snapshot tests are disabled.")
def test_force_delete_snapshot(self): def test_force_delete_snapshot(self):
sn = self.create_snapshot_wait_for_active(self.sh["id"]) sn = self.create_snapshot_wait_for_active(self.share["id"])
# Change status from 'available' to 'error_deleting' # Change status from 'available' to 'error_deleting'
self.shares_v2_client.reset_state( self.shares_v2_client.reset_state(
@ -152,9 +155,10 @@ class AdminActionsTest(base.BaseSharesAdminTest):
@utils.skip_if_microversion_not_supported("2.22") @utils.skip_if_microversion_not_supported("2.22")
def test_reset_share_task_state(self): def test_reset_share_task_state(self):
for task_state in self.task_states: for task_state in self.task_states:
self.shares_v2_client.reset_task_state(self.sh["id"], task_state) self.shares_v2_client.reset_task_state(self.share["id"],
task_state)
waiters.wait_for_resource_status( waiters.wait_for_resource_status(
self.shares_v2_client, self.sh["id"], task_state, self.shares_v2_client, self.share["id"], task_state,
status_attr='task_state') status_attr='task_state')
@decorators.idempotent_id('4233b941-a909-4f35-9ec9-753736949dd2') @decorators.idempotent_id('4233b941-a909-4f35-9ec9-753736949dd2')
@ -163,7 +167,7 @@ class AdminActionsTest(base.BaseSharesAdminTest):
# This check will ensure that when a share creation request is handled, # This check will ensure that when a share creation request is handled,
# if the driver has the "driver handles share servers" option enabled, # if the driver has the "driver handles share servers" option enabled,
# that a share server will be created, otherwise, not. # that a share server will be created, otherwise, not.
share_get = self.admin_shares_v2_client.get_share(self.sh['id']) share_get = self.admin_shares_v2_client.get_share(self.share['id'])
share_server = share_get['share_server_id'] share_server = share_get['share_server_id']
if CONF.share.multitenancy_enabled: if CONF.share.multitenancy_enabled:
self.assertNotEmpty(share_server) self.assertNotEmpty(share_server)

View File

@ -34,24 +34,27 @@ class AdminActionsNegativeTest(base.BaseSharesMixedTest):
cls.admin_client = cls.admin_shares_v2_client cls.admin_client = cls.admin_shares_v2_client
cls.member_client = cls.shares_v2_client cls.member_client = cls.shares_v2_client
# create share type # create share type
cls.share_type = cls._create_share_type() extra_specs = {}
if CONF.share.capability_snapshot_support:
extra_specs.update({'snapshot_support': True})
cls.share_type = cls._create_share_type(specs=extra_specs)
cls.share_type_id = cls.share_type['id'] cls.share_type_id = cls.share_type['id']
# create share # create share
cls.sh = cls.create_share(share_type_id=cls.share_type_id, cls.share = cls.create_share(share_type_id=cls.share_type_id,
client=cls.admin_client) client=cls.admin_client)
cls.sh_instance = ( cls.sh_instance = (
cls.admin_client.get_instances_of_share(cls.sh["id"])[0] cls.admin_client.get_instances_of_share(cls.share["id"])[0]
) )
if CONF.share.run_snapshot_tests: if CONF.share.run_snapshot_tests:
cls.sn = cls.create_snapshot_wait_for_active( cls.snapshot = cls.create_snapshot_wait_for_active(
cls.sh["id"], client=cls.admin_client) cls.share["id"], client=cls.admin_client)
@decorators.idempotent_id('f730c395-a501-44cf-90d9-a3273771b895') @decorators.idempotent_id('f730c395-a501-44cf-90d9-a3273771b895')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND) @tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
def test_reset_share_state_to_unacceptable_state(self): def test_reset_share_state_to_unacceptable_state(self):
self.assertRaises(lib_exc.BadRequest, self.assertRaises(lib_exc.BadRequest,
self.admin_client.reset_state, self.admin_client.reset_state,
self.sh["id"], status="fake") self.share["id"], status="fake")
@decorators.idempotent_id('3bfa9555-9c7e-45a2-b5bd-384329cb6fda') @decorators.idempotent_id('3bfa9555-9c7e-45a2-b5bd-384329cb6fda')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND) @tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
@ -71,7 +74,9 @@ class AdminActionsNegativeTest(base.BaseSharesMixedTest):
def test_reset_snapshot_state_to_unacceptable_state(self): def test_reset_snapshot_state_to_unacceptable_state(self):
self.assertRaises(lib_exc.BadRequest, self.assertRaises(lib_exc.BadRequest,
self.admin_client.reset_state, self.admin_client.reset_state,
self.sn["id"], s_type="snapshots", status="fake") self.snapshot["id"],
s_type="snapshots",
status="fake")
@decorators.idempotent_id('3b525c29-b657-493f-aa41-b17676a95fd2') @decorators.idempotent_id('3b525c29-b657-493f-aa41-b17676a95fd2')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND) @tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
@ -79,7 +84,7 @@ class AdminActionsNegativeTest(base.BaseSharesMixedTest):
# Even if member from another tenant, it should be unauthorized # Even if member from another tenant, it should be unauthorized
self.assertRaises(lib_exc.Forbidden, self.assertRaises(lib_exc.Forbidden,
self.member_client.reset_state, self.member_client.reset_state,
self.sh["id"]) self.share["id"])
@decorators.idempotent_id('d4abddba-1c20-49e1-85b1-5452f0faceb0') @decorators.idempotent_id('d4abddba-1c20-49e1-85b1-5452f0faceb0')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND) @tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
@ -97,7 +102,7 @@ class AdminActionsNegativeTest(base.BaseSharesMixedTest):
# Even if member from another tenant, it should be unauthorized # Even if member from another tenant, it should be unauthorized
self.assertRaises(lib_exc.Forbidden, self.assertRaises(lib_exc.Forbidden,
self.member_client.reset_state, self.member_client.reset_state,
self.sn["id"], s_type="snapshots") self.snapshot["id"], s_type="snapshots")
@decorators.idempotent_id('7cd0b48e-2815-4f8c-8718-3c071ff9701f') @decorators.idempotent_id('7cd0b48e-2815-4f8c-8718-3c071ff9701f')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND) @tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
@ -105,7 +110,7 @@ class AdminActionsNegativeTest(base.BaseSharesMixedTest):
# If a non-admin tries to do force_delete, it should be unauthorized # If a non-admin tries to do force_delete, it should be unauthorized
self.assertRaises(lib_exc.Forbidden, self.assertRaises(lib_exc.Forbidden,
self.member_client.force_delete, self.member_client.force_delete,
self.sh["id"]) self.share["id"])
@decorators.idempotent_id('257da3e0-9460-4d97-8a56-c86c0427cc64') @decorators.idempotent_id('257da3e0-9460-4d97-8a56-c86c0427cc64')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND) @tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
@ -123,7 +128,7 @@ class AdminActionsNegativeTest(base.BaseSharesMixedTest):
# If a non-admin tries to do force_delete, it should be unauthorized # If a non-admin tries to do force_delete, it should be unauthorized
self.assertRaises(lib_exc.Forbidden, self.assertRaises(lib_exc.Forbidden,
self.member_client.force_delete, self.member_client.force_delete,
self.sn["id"], s_type="snapshots") self.snapshot["id"], s_type="snapshots")
@decorators.idempotent_id('821da7c8-3501-44ba-9ffe-45f485a6e573') @decorators.idempotent_id('821da7c8-3501-44ba-9ffe-45f485a6e573')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND) @tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
@ -140,7 +145,7 @@ class AdminActionsNegativeTest(base.BaseSharesMixedTest):
# unauthorized # unauthorized
self.assertRaises(lib_exc.Forbidden, self.assertRaises(lib_exc.Forbidden,
self.member_client.get_instances_of_share, self.member_client.get_instances_of_share,
self.sh['id']) self.share['id'])
@decorators.idempotent_id('d662457c-2b84-4f13-aee7-5ffafe2552f1') @decorators.idempotent_id('d662457c-2b84-4f13-aee7-5ffafe2552f1')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND) @tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
@ -148,7 +153,7 @@ class AdminActionsNegativeTest(base.BaseSharesMixedTest):
def test_reset_task_state_invalid_state(self): def test_reset_task_state_invalid_state(self):
self.assertRaises( self.assertRaises(
lib_exc.BadRequest, self.admin_client.reset_task_state, lib_exc.BadRequest, self.admin_client.reset_task_state,
self.sh['id'], 'fake_state') self.share['id'], 'fake_state')
@ddt.ddt @ddt.ddt

View File

@ -72,8 +72,11 @@ class MigrationBase(base.BaseSharesAdminTest):
"needed to run share migration tests.") "needed to run share migration tests.")
# create share type (generic) # create share type (generic)
cls.share_type = cls._create_share_type() cls.share_type = cls.create_share_type(
cls.share_type_id = cls.share_type['id'] name=data_utils.rand_name('original_share_type_for_migration'),
cleanup_in_class=True,
extra_specs=utils.get_configured_extra_specs())
cls.share_type_id = cls.share_type['share_type']['id']
cls.new_type = cls.create_share_type( cls.new_type = cls.create_share_type(
name=data_utils.rand_name('new_share_type_for_migration'), name=data_utils.rand_name('new_share_type_for_migration'),
@ -338,7 +341,10 @@ class MigrationBase(base.BaseSharesAdminTest):
# Share type with snapshot support # Share type with snapshot support
st_name = data_utils.rand_name( st_name = data_utils.rand_name(
'snapshot_capable_share_type_for_migration') 'snapshot_capable_share_type_for_migration')
extra_specs = self.add_extra_specs_to_dict({"snapshot_support": True}) extra_specs = self.add_extra_specs_to_dict({
"snapshot_support": True,
"create_share_from_snapshot_support": True,
})
ss_type = self.create_share_type(st_name, extra_specs=extra_specs) ss_type = self.create_share_type(st_name, extra_specs=extra_specs)
# New share type with no snapshot support capability # New share type with no snapshot support capability

View File

@ -57,7 +57,11 @@ class MigrationNegativeTest(base.BaseSharesAdminTest):
"are needed to run share migration tests.") "are needed to run share migration tests.")
# create share type (generic) # create share type (generic)
cls.share_type = cls._create_share_type() extra_specs = {}
if CONF.share.capability_snapshot_support:
extra_specs.update({'snapshot_support': True})
cls.share_type = cls._create_share_type(specs=extra_specs)
cls.share_type_id = cls.share_type['id'] cls.share_type_id = cls.share_type['id']
# create share # create share

View File

@ -196,7 +196,12 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
def resource_setup(cls): def resource_setup(cls):
super(SharesAdminQuotasUpdateTest, cls).resource_setup() super(SharesAdminQuotasUpdateTest, cls).resource_setup()
# create share type # create share type
cls.share_type = cls._create_share_type() extra_specs = {}
if CONF.share.capability_snapshot_support:
extra_specs.update({'snapshot_support': True})
if CONF.share.capability_create_share_from_snapshot_support:
extra_specs.update({'create_share_from_snapshot_support': True})
cls.share_type = cls._create_share_type(specs=extra_specs)
cls.share_type_id = cls.share_type['id'] cls.share_type_id = cls.share_type['id']
# create share group type # create share group type
cls.share_group_type = cls._create_share_group_type() cls.share_group_type = cls._create_share_group_type()
@ -901,6 +906,11 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
@testtools.skipUnless( @testtools.skipUnless(
CONF.share.run_share_group_tests, 'Share Group tests disabled.') CONF.share.run_share_group_tests, 'Share Group tests disabled.')
@utils.skip_if_microversion_not_supported(SHARE_GROUPS_MICROVERSION) @utils.skip_if_microversion_not_supported(SHARE_GROUPS_MICROVERSION)
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@testtools.skipUnless(
CONF.share.capability_create_share_from_snapshot_support,
"Tests for shares from snapshots are disabled.")
def test_share_group_quotas_usages(self): def test_share_group_quotas_usages(self):
# Set quotas for project (3 SG, 1 SGS) and user (2 SG, 1 SGS) # Set quotas for project (3 SG, 1 SGS) and user (2 SG, 1 SGS)
self.update_quotas(self.tenant_id, self.update_quotas(self.tenant_id,

View File

@ -56,6 +56,8 @@ class ReplicationActionsAdminTest(base.BaseSharesMixedTest):
# create share type # create share type
extra_specs = {"replication_type": cls.replication_type} extra_specs = {"replication_type": cls.replication_type}
if CONF.share.capability_snapshot_support:
extra_specs.update({"snapshot_support": True})
cls.share_type = cls._create_share_type(specs=extra_specs) cls.share_type = cls._create_share_type(specs=extra_specs)
cls.share_type_id = cls.share_type['id'] cls.share_type_id = cls.share_type['id']

View File

@ -45,10 +45,12 @@ class ShareGroupsTest(base.BaseSharesAdminTest):
def resource_setup(cls): def resource_setup(cls):
super(ShareGroupsTest, cls).resource_setup() super(ShareGroupsTest, cls).resource_setup()
# Create 2 share_types # Create 2 share_types
cls.share_type = cls._create_share_type() extra_specs = {}
if CONF.share.capability_snapshot_support:
extra_specs.update({'snapshot_support': True})
cls.share_type = cls._create_share_type(specs=extra_specs)
cls.share_type_id = cls.share_type['id'] cls.share_type_id = cls.share_type['id']
cls.share_type2 = cls._create_share_type(specs=extra_specs)
cls.share_type2 = cls._create_share_type()
cls.share_type_id2 = cls.share_type2['id'] cls.share_type_id2 = cls.share_type2['id']
# Create a share group type # Create a share group type
@ -176,6 +178,8 @@ class ShareGroupsTest(base.BaseSharesAdminTest):
@decorators.idempotent_id('8ca1f0a0-2a36-4adb-af6b-6741b00307c5') @decorators.idempotent_id('8ca1f0a0-2a36-4adb-af6b-6741b00307c5')
@testtools.skipUnless( @testtools.skipUnless(
CONF.share.multitenancy_enabled, "Only for multitenancy.") CONF.share.multitenancy_enabled, "Only for multitenancy.")
@testtools.skipUnless(
CONF.share.run_snapshot_tests, "Snapshot tests are disabled.")
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND) @tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
def test_create_sg_from_snapshot_verify_share_server_information_min(self): def test_create_sg_from_snapshot_verify_share_server_information_min(self):
# Create a share group # Create a share group

View File

@ -41,16 +41,13 @@ class ShareGroupsNegativeTest(base.BaseSharesAdminTest):
@tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND) @tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
def test_create_share_group_with_wrong_consistent_snapshot_spec(self): def test_create_share_group_with_wrong_consistent_snapshot_spec(self):
# Create valid share type for share group type # Create valid share type for share group type
name = data_utils.rand_name("tempest-manila") share_type = self._create_share_type(cleanup_in_class=False)
extra_specs = self.add_extra_specs_to_dict()
st = self.create_share_type(name, extra_specs=extra_specs)
share_type = st['share_type'] if 'share_type' in st else st
# Create share group type with wrong value for # Create share group type with wrong value for
# 'consistent_snapshot_support' capability, we always expect # 'consistent_snapshot_support' capability, we always expect
# NoValidHostFound using this SG type. # NoValidHostFound using this SG type.
sg_type = self.create_share_group_type( sg_type = self.create_share_group_type(
name=name, name=data_utils.rand_name("tempest-manila"),
share_types=[share_type['id']], share_types=[share_type['id']],
group_specs={"consistent_snapshot_support": "fake"}, group_specs={"consistent_snapshot_support": "fake"},
cleanup_in_class=False) cleanup_in_class=False)

View File

@ -57,7 +57,10 @@ class MigrationShareServerBase(base.BaseSharesAdminTest):
raise cls.skipException(msg) raise cls.skipException(msg)
# create share type (generic) # create share type (generic)
cls.share_type = cls._create_share_type() extra_specs = {}
if CONF.share.capability_snapshot_support:
extra_specs.update({'snapshot_support': True})
cls.share_type = cls._create_share_type(specs=extra_specs)
# create two non routable IPs to be used in NFS access rulesi # create two non routable IPs to be used in NFS access rulesi
cls.access_rules_ip_rw = utils.rand_ip() cls.access_rules_ip_rw = utils.rand_ip()

View File

@ -40,7 +40,8 @@ class ShareSnapshotInstancesTest(base.BaseSharesAdminTest):
def resource_setup(cls): def resource_setup(cls):
super(ShareSnapshotInstancesTest, cls).resource_setup() super(ShareSnapshotInstancesTest, cls).resource_setup()
# create share type # create share type
cls.share_type = cls._create_share_type() extra_specs = {'snapshot_support': True}
cls.share_type = cls._create_share_type(specs=extra_specs)
cls.share_type_id = cls.share_type['id'] cls.share_type_id = cls.share_type['id']
# create share # create share
cls.share = cls.create_share(share_type_id=cls.share_type_id) cls.share = cls.create_share(share_type_id=cls.share_type_id)

View File

@ -40,7 +40,8 @@ class SnapshotInstancesNegativeTest(base.BaseSharesMixedTest):
cls.admin_client = cls.admin_shares_v2_client cls.admin_client = cls.admin_shares_v2_client
cls.member_client = cls.shares_v2_client cls.member_client = cls.shares_v2_client
# create share type # create share type
cls.share_type = cls._create_share_type() extra_specs = {'snapshot_support': True}
cls.share_type = cls._create_share_type(specs=extra_specs)
cls.share_type_id = cls.share_type['id'] cls.share_type_id = cls.share_type['id']
# create share # create share
cls.share = cls.create_share(share_type_id=cls.share_type_id, cls.share = cls.create_share(share_type_id=cls.share_type_id,

View File

@ -93,9 +93,17 @@ class ShareTypesAdminTest(base.BaseSharesAdminTest):
# Get share type # Get share type
get = self.shares_v2_client.get_share_type(st_id, version=version) get = self.shares_v2_client.get_share_type(st_id, version=version)
self.assertEqual(name, get["share_type"]["name"]) self.assertEqual(name, get["share_type"]["name"])
self.assertEqual(st_id, get["share_type"]["id"]) self.assertEqual(st_id, get["share_type"]["id"])
self._verify_description(description, get['share_type'], version) self._verify_description(description, get['share_type'], version)
if utils.is_microversion_lt(version, "2.24"):
# snapshot_support is an implied/required extra-spec until
# version 2.24, and the service assumes it to be True since we
# don't provide it during share type creation.
extra_specs.update({"snapshot_support": 'True'})
self.assertEqual(extra_specs, get["share_type"]["extra_specs"]) self.assertEqual(extra_specs, get["share_type"]["extra_specs"])
self._verify_is_public_key_name(get['share_type'], version) self._verify_is_public_key_name(get['share_type'], version)

View File

@ -128,12 +128,25 @@ class ExtraSpecsWriteAdminTest(base.BaseSharesAdminTest):
@tc.attr(base.TAG_POSITIVE, base.TAG_API) @tc.attr(base.TAG_POSITIVE, base.TAG_API)
@ddt.data(*utils.deduplicate(['2.24', LATEST_MICROVERSION])) @ddt.data(*utils.deduplicate(['2.24', LATEST_MICROVERSION]))
def test_delete_snapshot_support_extra_spec(self, version): def test_delete_snapshot_support_extra_spec(self, version):
"""Is snapshot_support really an optional extra-spec if API > v2.24?"""
utils.check_skip_if_microversion_not_supported(version) utils.check_skip_if_microversion_not_supported(version)
# Delete one extra spec for share type
# set snapshot_support extra-spec
self.shares_v2_client.update_share_type_extra_specs(
self.st_id, {'snapshot_support': 'True'})
# Get extra specs
share_type_extra_specs = self.shares_client.get_share_type_extra_specs(
self.st_id)
self.assertIn('snapshot_support', share_type_extra_specs)
self.assertEqual('True', share_type_extra_specs['snapshot_support'])
# Delete the 'snapshot_support' extra spec from the share type
self.shares_v2_client.delete_share_type_extra_spec( self.shares_v2_client.delete_share_type_extra_spec(
self.st_id, 'snapshot_support', version=version) self.st_id, 'snapshot_support', version=version)
# Get metadata # Get extra specs
share_type_extra_specs = self.shares_client.get_share_type_extra_specs( share_type_extra_specs = self.shares_client.get_share_type_extra_specs(
self.st_id) self.st_id)

View File

@ -38,6 +38,10 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
# create share type for share filtering purposes # create share type for share filtering purposes
specs = {"storage_protocol": CONF.share.capability_storage_protocol} specs = {"storage_protocol": CONF.share.capability_storage_protocol}
if CONF.share.capability_snapshot_support:
specs.update({'snapshot_support': True})
if CONF.share.capability_create_share_from_snapshot_support:
specs.update({'create_share_from_snapshot_support': True})
cls.share_type = cls._create_share_type(specs=specs) cls.share_type = cls._create_share_type(specs=specs)
cls.share_type_id = cls.share_type['id'] cls.share_type_id = cls.share_type['id']

View File

@ -49,7 +49,11 @@ class SnapshotExportLocationsTest(base.BaseSharesMixedTest):
def resource_setup(cls): def resource_setup(cls):
super(SnapshotExportLocationsTest, cls).resource_setup() super(SnapshotExportLocationsTest, cls).resource_setup()
# create share type # create share type
cls.share_type = cls._create_share_type() extra_specs = {
'snapshot_support': True,
'mount_snapshot_support': True,
}
cls.share_type = cls._create_share_type(specs=extra_specs)
cls.share_type_id = cls.share_type['id'] cls.share_type_id = cls.share_type['id']
# create share # create share
cls.share = cls.create_share(share_type_id=cls.share_type_id, cls.share = cls.create_share(share_type_id=cls.share_type_id,

View File

@ -46,7 +46,11 @@ class SnapshotExportLocationsNegativeTest(base.BaseSharesMixedTest):
def resource_setup(cls): def resource_setup(cls):
super(SnapshotExportLocationsNegativeTest, cls).resource_setup() super(SnapshotExportLocationsNegativeTest, cls).resource_setup()
# create share type # create share type
cls.share_type = cls._create_share_type() extra_specs = {
'snapshot_support': True,
'mount_snapshot_support': True,
}
cls.share_type = cls._create_share_type(specs=extra_specs)
cls.share_type_id = cls.share_type['id'] cls.share_type_id = cls.share_type['id']
# create share # create share
cls.share = cls.create_share(share_type_id=cls.share_type_id, cls.share = cls.create_share(share_type_id=cls.share_type_id,

View File

@ -852,26 +852,9 @@ class BaseSharesTest(test.BaseTestCase):
def add_extra_specs_to_dict(extra_specs=None): def add_extra_specs_to_dict(extra_specs=None):
"""Add any required extra-specs to share type dictionary""" """Add any required extra-specs to share type dictionary"""
dhss = six.text_type(CONF.share.multitenancy_enabled) dhss = six.text_type(CONF.share.multitenancy_enabled)
snapshot_support = six.text_type( extra_specs_dict = {"driver_handles_share_servers": dhss}
CONF.share.capability_snapshot_support)
create_from_snapshot_support = six.text_type(
CONF.share.capability_create_share_from_snapshot_support)
extra_specs_dict = {
"driver_handles_share_servers": dhss,
}
optional = {
"snapshot_support": snapshot_support,
"create_share_from_snapshot_support": create_from_snapshot_support,
}
# NOTE(gouthamr): In micro-versions < 2.24, snapshot_support is a
# required extra-spec
extra_specs_dict.update(optional)
if extra_specs: if extra_specs:
extra_specs_dict.update(extra_specs) extra_specs_dict.update(extra_specs)
return extra_specs_dict return extra_specs_dict
@classmethod @classmethod
@ -1111,12 +1094,14 @@ class BaseSharesAdminTest(BaseSharesTest):
cls.admin_shares_v2_client = cls.os_admin.share_v2.SharesV2Client() cls.admin_shares_v2_client = cls.os_admin.share_v2.SharesV2Client()
@classmethod @classmethod
def _create_share_type(cls, is_public=True, specs=None): def _create_share_type(cls, is_public=True, specs=None,
cleanup_in_class=True):
name = data_utils.rand_name("unique_st_name") name = data_utils.rand_name("unique_st_name")
extra_specs = cls.add_extra_specs_to_dict(specs) extra_specs = cls.add_extra_specs_to_dict(specs)
return cls.create_share_type( return cls.create_share_type(
name, extra_specs=extra_specs, is_public=is_public, name, extra_specs=extra_specs, is_public=is_public,
client=cls.admin_shares_v2_client)['share_type'] client=cls.admin_shares_v2_client,
cleanup_in_class=cleanup_in_class)['share_type']
@classmethod @classmethod
def _create_share_group_type(cls): def _create_share_group_type(cls):
@ -1308,12 +1293,14 @@ class BaseSharesMixedTest(BaseSharesTest):
return os return os
@classmethod @classmethod
def _create_share_type(cls, is_public=True, specs=None): def _create_share_type(cls, is_public=True, specs=None,
cleanup_in_class=True):
name = data_utils.rand_name("unique_st_name") name = data_utils.rand_name("unique_st_name")
extra_specs = cls.add_extra_specs_to_dict(specs) extra_specs = cls.add_extra_specs_to_dict(specs)
return cls.create_share_type( return cls.create_share_type(
name, extra_specs=extra_specs, is_public=is_public, name, extra_specs=extra_specs, is_public=is_public,
client=cls.admin_shares_v2_client)['share_type'] client=cls.admin_shares_v2_client,
cleanup_in_class=cleanup_in_class)['share_type']
@classmethod @classmethod
def _create_share_group_type(cls): def _create_share_group_type(cls):

View File

@ -55,7 +55,14 @@ class ReplicationSnapshotTest(base.BaseSharesMixedTest):
) )
# create share type # create share type
extra_specs = {"replication_type": cls.replication_type} extra_specs = {
"replication_type": cls.replication_type,
"snapshot_support": True,
}
if CONF.share.capability_create_share_from_snapshot_support:
extra_specs.update({
"create_share_from_snapshot_support": True,
})
cls.share_type = cls._create_share_type(specs=extra_specs) cls.share_type = cls._create_share_type(specs=extra_specs)
cls.share_type_id = cls.share_type['id'] cls.share_type_id = cls.share_type['id']
cls.sn_id = None cls.sn_id = None

View File

@ -63,7 +63,10 @@ class RevertToSnapshotTest(base.BaseSharesMixedTest):
raise cls.skipException(msg) raise cls.skipException(msg)
cls.share_type_name = data_utils.rand_name("share-type") cls.share_type_name = data_utils.rand_name("share-type")
extra_specs = {constants.REVERT_TO_SNAPSHOT_SUPPORT: True} extra_specs = {
"snapshot_support": True,
constants.REVERT_TO_SNAPSHOT_SUPPORT: True,
}
cls.revert_enabled_extra_specs = cls.add_extra_specs_to_dict( cls.revert_enabled_extra_specs = cls.add_extra_specs_to_dict(
extra_specs=extra_specs) extra_specs=extra_specs)
@ -86,6 +89,7 @@ class RevertToSnapshotTest(base.BaseSharesMixedTest):
) )
extra_specs = cls.add_extra_specs_to_dict({ extra_specs = cls.add_extra_specs_to_dict({
"replication_type": cls.replication_type, "replication_type": cls.replication_type,
"snapshot_support": True,
constants.REVERT_TO_SNAPSHOT_SUPPORT: True, constants.REVERT_TO_SNAPSHOT_SUPPORT: True,
}) })
share_type = cls.create_share_type( share_type = cls.create_share_type(

View File

@ -60,7 +60,10 @@ class RevertToSnapshotNegativeTest(base.BaseSharesMixedTest):
raise cls.skipException(msg) raise cls.skipException(msg)
cls.share_type_name = data_utils.rand_name("share-type") cls.share_type_name = data_utils.rand_name("share-type")
extra_specs = {constants.REVERT_TO_SNAPSHOT_SUPPORT: True} extra_specs = {
"snapshot_support": True,
constants.REVERT_TO_SNAPSHOT_SUPPORT: True
}
cls.revert_enabled_extra_specs = cls.add_extra_specs_to_dict( cls.revert_enabled_extra_specs = cls.add_extra_specs_to_dict(
extra_specs=extra_specs) extra_specs=extra_specs)

View File

@ -48,7 +48,10 @@ class ShareIpRulesForNFSNegativeTest(base.BaseSharesMixedTest):
cls.admin_client = cls.admin_shares_v2_client cls.admin_client = cls.admin_shares_v2_client
# create share_type # create share_type
cls.share_type = cls._create_share_type() extra_specs = None
if CONF.share.run_snapshot_tests:
extra_specs = {'snapshot_support': True}
cls.share_type = cls._create_share_type(specs=extra_specs)
cls.share_type_id = cls.share_type['id'] cls.share_type_id = cls.share_type['id']
# create share # create share
cls.share = cls.create_share(cls.protocol, cls.share = cls.create_share(cls.protocol,
@ -213,7 +216,10 @@ class ShareUserRulesForNFSNegativeTest(base.BaseSharesMixedTest):
msg = "USER rule tests for %s protocol are disabled" % cls.protocol msg = "USER rule tests for %s protocol are disabled" % cls.protocol
raise cls.skipException(msg) raise cls.skipException(msg)
# create share type # create share type
cls.share_type = cls._create_share_type() extra_specs = None
if CONF.share.run_snapshot_tests:
extra_specs = {'snapshot_support': True}
cls.share_type = cls._create_share_type(specs=extra_specs)
cls.share_type_id = cls.share_type['id'] cls.share_type_id = cls.share_type['id']
# create share # create share
cls.share = cls.create_share(cls.protocol, cls.share = cls.create_share(cls.protocol,
@ -315,7 +321,10 @@ class ShareCertRulesForGLUSTERFSNegativeTest(base.BaseSharesMixedTest):
msg = "CERT rule tests for %s protocol are disabled" % cls.protocol msg = "CERT rule tests for %s protocol are disabled" % cls.protocol
raise cls.skipException(msg) raise cls.skipException(msg)
# create share type # create share type
cls.share_type = cls._create_share_type() extra_specs = None
if CONF.share.run_snapshot_tests:
extra_specs = {'snapshot_support': True}
cls.share_type = cls._create_share_type(specs=extra_specs)
cls.share_type_id = cls.share_type['id'] cls.share_type_id = cls.share_type['id']
# create share # create share
cls.share = cls.create_share(cls.protocol, cls.share = cls.create_share(cls.protocol,
@ -501,7 +510,10 @@ class ShareRulesNegativeTest(base.BaseSharesMixedTest):
def resource_setup(cls): def resource_setup(cls):
super(ShareRulesNegativeTest, cls).resource_setup() super(ShareRulesNegativeTest, cls).resource_setup()
# create share type # create share type
cls.share_type = cls._create_share_type() extra_specs = None
if CONF.share.run_snapshot_tests:
extra_specs = {'snapshot_support': True}
cls.share_type = cls._create_share_type(specs=extra_specs)
cls.share_type_id = cls.share_type['id'] cls.share_type_id = cls.share_type['id']
# create share # create share
cls.share = cls.create_share(share_type_id=cls.share_type_id) cls.share = cls.create_share(share_type_id=cls.share_type_id)

View File

@ -18,6 +18,7 @@ import ddt
from tempest import config from tempest import config
from tempest.lib.common.utils import data_utils from tempest.lib.common.utils import data_utils
from tempest.lib import decorators from tempest.lib import decorators
import testtools
from testtools import testcase as tc from testtools import testcase as tc
from manila_tempest_tests.common import constants from manila_tempest_tests.common import constants
@ -46,7 +47,12 @@ class ShareGroupActionsTest(base.BaseSharesMixedTest):
super(ShareGroupActionsTest, cls).resource_setup() super(ShareGroupActionsTest, cls).resource_setup()
# Create a share type # Create a share type
cls.share_type = cls._create_share_type() extra_specs = {}
if CONF.share.capability_snapshot_support:
extra_specs.update({'snapshot_support': True})
if CONF.share.capability_create_share_from_snapshot_support:
extra_specs.update({'create_share_from_snapshot_support': True})
cls.share_type = cls._create_share_type(specs=extra_specs)
cls.share_type_id = cls.share_type['id'] cls.share_type_id = cls.share_type['id']
cls.share_group_type = cls._create_share_group_type() cls.share_group_type = cls._create_share_group_type()
@ -89,20 +95,21 @@ class ShareGroupActionsTest(base.BaseSharesMixedTest):
]) ])
# Create share group snapshots # Create share group snapshots
cls.sg_snap_name = data_utils.rand_name("tempest-sg-snap-name") if CONF.share.capability_snapshot_support:
cls.sg_snap_desc = data_utils.rand_name("tempest-sg-snap-desc") cls.sg_snap_name = data_utils.rand_name("tempest-sg-snap-name")
cls.sg_snap_desc = data_utils.rand_name("tempest-sg-snap-desc")
cls.sg_snapshot = cls.create_share_group_snapshot_wait_for_active( cls.sg_snapshot = cls.create_share_group_snapshot_wait_for_active(
cls.share_group["id"], cls.share_group["id"],
name=cls.sg_snap_name, name=cls.sg_snap_name,
description=cls.sg_snap_desc, description=cls.sg_snap_desc,
) )
cls.sg_snapshot2 = cls.create_share_group_snapshot_wait_for_active( cls.sg_snapshot2 = cls.create_share_group_snapshot_wait_for_active(
cls.share_group2['id'], cls.share_group2['id'],
name=cls.sg_snap_name, name=cls.sg_snap_name,
description=cls.sg_snap_desc, description=cls.sg_snap_desc,
) )
@decorators.idempotent_id('1e359389-09a7-4235-84c9-7b5c83632fff') @decorators.idempotent_id('1e359389-09a7-4235-84c9-7b5c83632fff')
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND) @tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
@ -258,6 +265,8 @@ class ShareGroupActionsTest(base.BaseSharesMixedTest):
*utils.deduplicate([constants.MIN_SHARE_GROUP_MICROVERSION, *utils.deduplicate([constants.MIN_SHARE_GROUP_MICROVERSION,
constants.SHARE_GROUPS_GRADUATION_VERSION, constants.SHARE_GROUPS_GRADUATION_VERSION,
LATEST_MICROVERSION])) LATEST_MICROVERSION]))
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_get_share_group_snapshot(self, version): def test_get_share_group_snapshot(self, version):
utils.check_skip_if_microversion_not_supported(version) utils.check_skip_if_microversion_not_supported(version)
@ -286,6 +295,8 @@ class ShareGroupActionsTest(base.BaseSharesMixedTest):
@decorators.idempotent_id('67e8c099-f1c1-4972-9c51-bb7bfe1d7994') @decorators.idempotent_id('67e8c099-f1c1-4972-9c51-bb7bfe1d7994')
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND) @tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_get_share_group_snapshot_members_min(self): def test_get_share_group_snapshot_members_min(self):
sg_snapshot = self.shares_v2_client.get_share_group_snapshot( sg_snapshot = self.shares_v2_client.get_share_group_snapshot(
self.sg_snapshot['id'], self.sg_snapshot['id'],
@ -315,6 +326,11 @@ class ShareGroupActionsTest(base.BaseSharesMixedTest):
*utils.deduplicate([constants.MIN_SHARE_GROUP_MICROVERSION, *utils.deduplicate([constants.MIN_SHARE_GROUP_MICROVERSION,
constants.SHARE_GROUPS_GRADUATION_VERSION, constants.SHARE_GROUPS_GRADUATION_VERSION,
LATEST_MICROVERSION])) LATEST_MICROVERSION]))
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@testtools.skipUnless(
CONF.share.capability_create_share_from_snapshot_support,
"Tests creating shares from snapshots are disabled.")
def test_create_share_group_from_populated_share_group_snapshot(self, def test_create_share_group_from_populated_share_group_snapshot(self,
version): version):
utils.check_skip_if_microversion_not_supported(version) utils.check_skip_if_microversion_not_supported(version)

View File

@ -17,6 +17,7 @@ import ddt
from tempest import config from tempest import config
from tempest.lib import decorators from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc from tempest.lib import exceptions as lib_exc
import testtools
from testtools import testcase as tc from testtools import testcase as tc
from manila_tempest_tests.common import constants from manila_tempest_tests.common import constants
@ -43,7 +44,12 @@ class ShareGroupsTest(base.BaseSharesMixedTest):
def resource_setup(cls): def resource_setup(cls):
super(ShareGroupsTest, cls).resource_setup() super(ShareGroupsTest, cls).resource_setup()
# create share type # create share type
cls.share_type = cls._create_share_type() extra_specs = {}
if CONF.share.capability_snapshot_support:
extra_specs.update({'snapshot_support': True})
if CONF.share.capability_create_share_from_snapshot_support:
extra_specs.update({'create_share_from_snapshot_support': True})
cls.share_type = cls._create_share_type(specs=extra_specs)
cls.share_type_id = cls.share_type['id'] cls.share_type_id = cls.share_type['id']
# create share group type # create share group type
@ -97,6 +103,8 @@ class ShareGroupsTest(base.BaseSharesMixedTest):
@decorators.idempotent_id('cf7984af-1e1d-4eaf-bf9a-d8ddf5cebd01') @decorators.idempotent_id('cf7984af-1e1d-4eaf-bf9a-d8ddf5cebd01')
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND) @tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_create_delete_empty_share_group_snapshot_min(self): def test_create_delete_empty_share_group_snapshot_min(self):
# Create base share group # Create base share group
share_group = self.create_share_group( share_group = self.create_share_group(
@ -138,6 +146,8 @@ class ShareGroupsTest(base.BaseSharesMixedTest):
@decorators.idempotent_id('727d9c69-4c3b-4375-a91b-8b3efd349976') @decorators.idempotent_id('727d9c69-4c3b-4375-a91b-8b3efd349976')
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND) @tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_create_share_group_from_empty_share_group_snapshot_min(self): def test_create_share_group_from_empty_share_group_snapshot_min(self):
# Create base share group # Create base share group
share_group = self.create_share_group( share_group = self.create_share_group(

View File

@ -17,6 +17,7 @@ from tempest import config
from tempest.lib.common.utils import data_utils from tempest.lib.common.utils import data_utils
from tempest.lib import decorators from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc from tempest.lib import exceptions as lib_exc
import testtools
from testtools import testcase as tc from testtools import testcase as tc
from manila_tempest_tests.common import constants from manila_tempest_tests.common import constants
@ -42,7 +43,10 @@ class ShareGroupsNegativeTest(base.BaseSharesMixedTest):
def resource_setup(cls): def resource_setup(cls):
super(ShareGroupsNegativeTest, cls).resource_setup() super(ShareGroupsNegativeTest, cls).resource_setup()
# Create a share type # Create a share type
cls.share_type = cls._create_share_type() extra_specs = {}
if CONF.share.capability_snapshot_support:
extra_specs.update({'snapshot_support': True})
cls.share_type = cls._create_share_type(specs=extra_specs)
cls.share_type_id = cls.share_type['id'] cls.share_type_id = cls.share_type['id']
# Create a share group type # Create a share group type
@ -69,15 +73,16 @@ class ShareGroupsNegativeTest(base.BaseSharesMixedTest):
share_type_id=cls.share_type_id, share_type_id=cls.share_type_id,
share_group_id=cls.share_group['id'], share_group_id=cls.share_group['id'],
) )
# Create a share group snapshot of the share group if CONF.share.run_snapshot_tests:
cls.sg_snap_name = data_utils.rand_name("tempest-sg-snap-name") # Create a share group snapshot of the share group
cls.sg_snap_desc = data_utils.rand_name( cls.sg_snap_name = data_utils.rand_name("tempest-sg-snap-name")
"tempest-group-snap-description") cls.sg_snap_desc = data_utils.rand_name(
cls.sg_snapshot = cls.create_share_group_snapshot_wait_for_active( "tempest-group-snap-description")
cls.share_group['id'], cls.sg_snapshot = cls.create_share_group_snapshot_wait_for_active(
name=cls.sg_snap_name, cls.share_group['id'],
description=cls.sg_snap_desc name=cls.sg_snap_name,
) description=cls.sg_snap_desc
)
@decorators.idempotent_id('7ce3fb52-1bec-42b1-9b4f-671c8465764b') @decorators.idempotent_id('7ce3fb52-1bec-42b1-9b4f-671c8465764b')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND) @tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
@ -206,6 +211,8 @@ class ShareGroupsNegativeTest(base.BaseSharesMixedTest):
@decorators.idempotent_id('18fe2dee-4a07-484e-8f0f-bbc238500dc3') @decorators.idempotent_id('18fe2dee-4a07-484e-8f0f-bbc238500dc3')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND) @tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_delete_sg_in_use_by_sg_snapshot_min(self): def test_delete_sg_in_use_by_sg_snapshot_min(self):
self.assertRaises( self.assertRaises(
lib_exc.Conflict, lib_exc.Conflict,
@ -215,6 +222,8 @@ class ShareGroupsNegativeTest(base.BaseSharesMixedTest):
@decorators.idempotent_id('d2a58f10-cc86-498d-a5e0-1468d4345852') @decorators.idempotent_id('d2a58f10-cc86-498d-a5e0-1468d4345852')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND) @tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_delete_share_in_use_by_sg_snapshot_min(self): def test_delete_share_in_use_by_sg_snapshot_min(self):
params = {'share_group_id': self.share['share_group_id']} params = {'share_group_id': self.share['share_group_id']}
self.assertRaises( self.assertRaises(

View File

@ -42,9 +42,6 @@ class SharesNFSTest(base.BaseSharesMixedTest):
# create share_type # create share_type
cls.share_type = cls._create_share_type() cls.share_type = cls._create_share_type()
cls.share_type_id = cls.share_type['id'] cls.share_type_id = cls.share_type['id']
# create share
cls.share = cls.create_share(cls.protocol,
share_type_id=cls.share_type_id)
@decorators.idempotent_id('21ad41fb-04cf-493c-bc2f-66c80220898b') @decorators.idempotent_id('21ad41fb-04cf-493c-bc2f-66c80220898b')
@tc.attr(base.TAG_POSITIVE, base.TAG_BACKEND) @tc.attr(base.TAG_POSITIVE, base.TAG_BACKEND)
@ -128,9 +125,15 @@ class SharesNFSTest(base.BaseSharesMixedTest):
@testtools.skipUnless(CONF.share.run_snapshot_tests, @testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.") "Snapshot tests are disabled.")
def test_create_delete_snapshot(self): def test_create_delete_snapshot(self):
extra_specs = {'snapshot_support': True}
share_type = self._create_share_type(specs=extra_specs,
cleanup_in_class=False)
share = self.create_share(self.protocol,
share_type_id=share_type['id'],
cleanup_in_class=False)
# create snapshot # create snapshot
snap = self.create_snapshot_wait_for_active(self.share["id"]) snap = self.create_snapshot_wait_for_active(share["id"])
detailed_elements = {'name', 'id', 'description', detailed_elements = {'name', 'id', 'description',
'created_at', 'share_proto', 'size', 'share_size', 'created_at', 'share_proto', 'size', 'share_size',
@ -167,14 +170,23 @@ class SharesNFSTest(base.BaseSharesMixedTest):
"Create share from snapshot tests are disabled.") "Create share from snapshot tests are disabled.")
def test_create_share_from_snapshot(self): def test_create_share_from_snapshot(self):
# If multitenant driver used, share_network will be provided by default # If multitenant driver used, share_network will be provided by default
extra_specs = {
'snapshot_support': True,
'create_share_from_snapshot_support': True,
}
share_type = self._create_share_type(specs=extra_specs,
cleanup_in_class=False)
share = self.create_share(self.protocol,
share_type_id=share_type['id'],
cleanup_in_class=False)
# create snapshot # create snapshot
snap = self.create_snapshot_wait_for_active( snap = self.create_snapshot_wait_for_active(share["id"],
self.share["id"], cleanup_in_class=False) cleanup_in_class=False)
# create share from snapshot # create share from snapshot
s2 = self.create_share(self.protocol, s2 = self.create_share(self.protocol,
share_type_id=self.share_type_id, share_type_id=share_type['id'],
snapshot_id=snap["id"], snapshot_id=snap["id"],
cleanup_in_class=False) cleanup_in_class=False)
@ -204,16 +216,25 @@ class SharesNFSTest(base.BaseSharesMixedTest):
# when creating share from snapshot using a driver that supports # when creating share from snapshot using a driver that supports
# multi-tenancy. # multi-tenancy.
extra_specs = {
'snapshot_support': True,
'create_share_from_snapshot_support': True,
}
share_type = self._create_share_type(specs=extra_specs,
cleanup_in_class=False)
share = self.create_share(self.protocol,
share_type_id=share_type['id'],
cleanup_in_class=False)
# get parent share # get parent share
parent = self.shares_client.get_share(self.share["id"]) parent = self.shares_client.get_share(share["id"])
# create snapshot # create snapshot
snap = self.create_snapshot_wait_for_active( snap = self.create_snapshot_wait_for_active(share["id"],
self.share["id"], cleanup_in_class=False) cleanup_in_class=False)
# create share from snapshot # create share from snapshot
child = self.create_share(self.protocol, child = self.create_share(self.protocol,
share_type_id=self.share_type_id,
snapshot_id=snap["id"], snapshot_id=snap["id"],
cleanup_in_class=False) cleanup_in_class=False)
@ -226,7 +247,7 @@ class SharesNFSTest(base.BaseSharesMixedTest):
# verify share, created from snapshot # verify share, created from snapshot
get = self.shares_client.get_share(child["id"]) get = self.shares_client.get_share(child["id"])
keys = { keys = {
"share": self.share["id"], "share": share["id"],
"actual_sn": get["share_network_id"], "actual_sn": get["share_network_id"],
"expected_sn": parent["share_network_id"], "expected_sn": parent["share_network_id"],
} }

View File

@ -41,7 +41,12 @@ class SharesActionsTest(base.BaseSharesMixedTest):
cls.shares = [] cls.shares = []
# create share_type # create share_type
cls.share_type = cls._create_share_type() extra_specs = {}
if CONF.share.capability_snapshot_support:
extra_specs.update({'snapshot_support': True})
if CONF.share.capability_create_share_from_snapshot_support:
extra_specs.update({'create_share_from_snapshot_support': True})
cls.share_type = cls._create_share_type(specs=extra_specs)
cls.share_type_id = cls.share_type['id'] cls.share_type_id = cls.share_type['id']
# create share # create share
@ -681,7 +686,10 @@ class SharesRenameTest(base.BaseSharesMixedTest):
super(SharesRenameTest, cls).resource_setup() super(SharesRenameTest, cls).resource_setup()
# create share_type # create share_type
cls.share_type = cls._create_share_type() extra_specs = {}
if CONF.share.capability_snapshot_support:
extra_specs.update({'snapshot_support': True})
cls.share_type = cls._create_share_type(specs=extra_specs)
cls.share_type_id = cls.share_type['id'] cls.share_type_id = cls.share_type['id']
# create share # create share

View File

@ -37,7 +37,10 @@ class SharesActionsNegativeTest(base.BaseSharesMixedTest):
cls.share_name = data_utils.rand_name("tempest-share-name") cls.share_name = data_utils.rand_name("tempest-share-name")
cls.share_desc = data_utils.rand_name("tempest-share-description") cls.share_desc = data_utils.rand_name("tempest-share-description")
# create share_type # create share_type
cls.share_type = cls._create_share_type() extra_specs = {}
if CONF.share.capability_snapshot_support:
extra_specs.update({'snapshot_support': True})
cls.share_type = cls._create_share_type(specs=extra_specs)
cls.share_type_id = cls.share_type['id'] cls.share_type_id = cls.share_type['id']
# create share # create share
cls.share = cls.create_share( cls.share = cls.create_share(

View File

@ -32,7 +32,12 @@ class SharesNegativeTest(base.BaseSharesMixedTest):
def resource_setup(cls): def resource_setup(cls):
super(SharesNegativeTest, cls).resource_setup() super(SharesNegativeTest, cls).resource_setup()
# create share_type # create share_type
cls.share_type = cls._create_share_type() extra_specs = {}
if CONF.share.capability_snapshot_support:
extra_specs.update({'snapshot_support': True})
if CONF.share.capability_create_share_from_snapshot_support:
extra_specs.update({'create_share_from_snapshot_support': True})
cls.share_type = cls._create_share_type(specs=extra_specs)
cls.share_type_id = cls.share_type['id'] cls.share_type_id = cls.share_type['id']
@decorators.idempotent_id('b9bb8dee-0c7c-4e51-909c-028335b1a6a0') @decorators.idempotent_id('b9bb8dee-0c7c-4e51-909c-028335b1a6a0')
@ -61,7 +66,6 @@ class SharesNegativeTest(base.BaseSharesMixedTest):
"Create share from snapshot tests are disabled.") "Create share from snapshot tests are disabled.")
def test_create_share_from_snap_with_less_size(self): def test_create_share_from_snap_with_less_size(self):
# requires minimum 5Gb available space # requires minimum 5Gb available space
skip_msg = "Check disc space for this test" skip_msg = "Check disc space for this test"
try: # create share try: # create share

View File

@ -35,7 +35,10 @@ class BaseShareSnapshotRulesTest(base.BaseSharesMixedTest):
def resource_setup(cls): def resource_setup(cls):
super(BaseShareSnapshotRulesTest, cls).resource_setup() super(BaseShareSnapshotRulesTest, cls).resource_setup()
# create share_type # create share_type
extra_specs = {'mount_snapshot_support': 'True'} extra_specs = {
'snapshot_support': True,
'mount_snapshot_support': True,
}
cls.share_type = cls._create_share_type(specs=extra_specs) cls.share_type = cls._create_share_type(specs=extra_specs)
cls.share_type_id = cls.share_type['id'] cls.share_type_id = cls.share_type['id']

View File

@ -50,7 +50,10 @@ class SnapshotIpRulesForNFSNegativeTest(
def resource_setup(cls): def resource_setup(cls):
super(SnapshotIpRulesForNFSNegativeTest, cls).resource_setup() super(SnapshotIpRulesForNFSNegativeTest, cls).resource_setup()
# create share type # create share type
extra_specs = {'mount_snapshot_support': 'True'} extra_specs = {
'snapshot_support': True,
'mount_snapshot_support': True,
}
cls.share_type = cls._create_share_type(specs=extra_specs) cls.share_type = cls._create_share_type(specs=extra_specs)
cls.share_type_id = cls.share_type['id'] cls.share_type_id = cls.share_type['id']
# create share # create share

View File

@ -268,12 +268,13 @@ class ShareScenarioTest(manager.NetworkScenarioTest):
def migration_complete(self, share_id, dest_host): def migration_complete(self, share_id, dest_host):
return self._migration_complete(share_id, dest_host) return self._migration_complete(share_id, dest_host)
def create_share(self, **kwargs): def create_share(self, extra_specs=None, **kwargs):
kwargs.update({ kwargs.update({
'share_protocol': self.protocol, 'share_protocol': self.protocol,
}) })
if not ('share_type_id' in kwargs or 'snapshot_id' in kwargs): if not ('share_type_id' in kwargs or 'snapshot_id' in kwargs):
default_share_type_id = self.get_share_type()['id'] default_share_type_id = self.get_share_type(
extra_specs=extra_specs)['id']
kwargs.update({'share_type_id': default_share_type_id}) kwargs.update({'share_type_id': default_share_type_id})
if CONF.share.multitenancy_enabled: if CONF.share.multitenancy_enabled:
kwargs.update({'share_network_id': self.share_network['id']}) kwargs.update({'share_network_id': self.share_network['id']})
@ -453,15 +454,17 @@ class ShareScenarioTest(manager.NetworkScenarioTest):
return self.os_primary.servers_client.show_server( return self.os_primary.servers_client.show_server(
instance_id)["server"] instance_id)["server"]
def get_share_type(self): def get_share_type(self, extra_specs=None):
if CONF.share.default_share_type_name: if CONF.share.default_share_type_name:
return self.shares_client.get_default_share_type()['share_type'] return self.shares_client.get_default_share_type()['share_type']
extra_specs_dict = {
'driver_handles_share_servers': CONF.share.multitenancy_enabled
}
if extra_specs:
extra_specs_dict.update(extra_specs)
return self._create_share_type( return self._create_share_type(
data_utils.rand_name("share_type"), data_utils.rand_name("share_type"),
extra_specs={ extra_specs=extra_specs_dict)['share_type']
'snapshot_support': CONF.share.capability_snapshot_support,
'driver_handles_share_servers': CONF.share.multitenancy_enabled
},)['share_type']
def get_share_export_locations(self, share): def get_share_export_locations(self, share):
if utils.is_microversion_lt(CONF.share.max_api_microversion, "2.9"): if utils.is_microversion_lt(CONF.share.max_api_microversion, "2.9"):

View File

@ -252,7 +252,8 @@ class ShareBasicOpsBase(manager.ShareScenarioTest):
instance = self.boot_instance(wait_until="BUILD") instance = self.boot_instance(wait_until="BUILD")
# 2 - Create share S1, ok, created # 2 - Create share S1, ok, created
parent_share = self.create_share() extra_specs = {'snapshot_support': True}
parent_share = self.create_share(extra_specs=extra_specs)
parent_share_export_location = self.get_user_export_locations( parent_share_export_location = self.get_user_export_locations(
parent_share)[0] parent_share)[0]
@ -350,7 +351,8 @@ class ShareBasicOpsBase(manager.ShareScenarioTest):
instance = self.boot_instance(wait_until="BUILD") instance = self.boot_instance(wait_until="BUILD")
# 2 - Create share S1, ok, created # 2 - Create share S1, ok, created
parent_share = self.create_share() extra_specs = {'snapshot_support': True}
parent_share = self.create_share(extra_specs=extra_specs)
user_export_location = self.get_user_export_locations(parent_share)[0] user_export_location = self.get_user_export_locations(parent_share)[0]
# Create client User Virtual Machine # Create client User Virtual Machine