NetApp: Support share revert to snapshot
This commit adds support for the revert-to-snapshot feature to
the NetApp cDOT drivers for both normal and replicated shares.
Implements: blueprint netapp-cdot-share-revert-to-snapshot
Change-Id: Ia939eba03b3db9cbba0cc6c16184578e8c8893d1
diff --git a/manila_tempest_tests/tests/api/test_revert_to_snapshot.py b/manila_tempest_tests/tests/api/test_revert_to_snapshot.py
index 686b185..91eca02 100644
--- a/manila_tempest_tests/tests/api/test_revert_to_snapshot.py
+++ b/manila_tempest_tests/tests/api/test_revert_to_snapshot.py
@@ -20,6 +20,7 @@
from testtools import testcase as tc
from manila_tempest_tests.common import constants
+from manila_tempest_tests import share_exceptions
from manila_tempest_tests.tests.api import base
CONF = config.CONF
@@ -72,6 +73,26 @@
cls.share = cls.create_share(share_type_id=cls.st_id)
+ if CONF.share.run_replication_tests:
+ # Create replicated share type
+ cls.replicated_share_type_name = data_utils.rand_name("share-type")
+ cls.replication_type = CONF.share.backend_replication_type
+ if cls.replication_type not in constants.REPLICATION_TYPE_CHOICES:
+ raise share_exceptions.ShareReplicationTypeException(
+ replication_type=cls.replication_type
+ )
+ cls.zones = cls.get_availability_zones(client=cls.admin_client)
+ cls.share_zone = cls.zones[0]
+ cls.replica_zone = cls.zones[-1]
+
+ extra_specs = cls.add_extra_specs_to_dict(
+ {"replication_type": cls.replication_type})
+ share_type = cls.create_share_type(
+ cls.replicated_share_type_name,
+ extra_specs=extra_specs,
+ client=cls.admin_client)
+ cls.replicated_share_type = share_type["share_type"]
+
@tc.attr(base.TAG_POSITIVE, base.TAG_BACKEND)
@ddt.data(
*{constants.REVERT_TO_SNAPSHOT_MICROVERSION,
@@ -107,3 +128,35 @@
version=version)
self.shares_v2_client.wait_for_share_status(self.share['id'],
constants.STATUS_AVAILABLE)
+
+ @tc.attr(base.TAG_POSITIVE, base.TAG_BACKEND)
+ @tc.skipUnless(CONF.share.run_replication_tests,
+ 'Replication tests are disabled.')
+ @ddt.data(
+ *{constants.REVERT_TO_SNAPSHOT_MICROVERSION,
+ CONF.share.max_api_microversion}
+ )
+ def test_revert_to_replicated_snapshot(self, version):
+ """Test reverting to a replicated snapshot."""
+ share = self.create_share(
+ share_type_id=self.replicated_share_type['id'],
+ availability_zone=self.share_zone
+ )
+
+ share_replica = self.create_share_replica(share["id"],
+ self.replica_zone)
+ self.shares_v2_client.wait_for_share_replica_status(
+ share_replica['id'], constants.REPLICATION_STATE_IN_SYNC,
+ status_attr='replica_state')
+
+ snapshot = self.create_snapshot_wait_for_active(share["id"])
+
+ self.shares_v2_client.revert_to_snapshot(
+ share['id'],
+ snapshot['id'],
+ version=version)
+ self.shares_v2_client.wait_for_share_status(share['id'],
+ constants.STATUS_AVAILABLE)
+ self.shares_v2_client.wait_for_share_replica_status(
+ share_replica['id'], constants.REPLICATION_STATE_IN_SYNC,
+ status_attr='replica_state')