Merge "Client support force extend share with v2.64"
diff --git a/manila_tempest_tests/common/remote_client.py b/manila_tempest_tests/common/remote_client.py
index 9970b0b..30e64c7 100644
--- a/manila_tempest_tests/common/remote_client.py
+++ b/manila_tempest_tests/common/remote_client.py
@@ -13,7 +13,6 @@
 import sys
 
 from oslo_log import log
-import six
 from tempest import config
 from tempest.lib.common import ssh
 from tempest.lib.common.utils import test_utils
@@ -47,7 +46,7 @@
                             msg = 'Could not get console_log for server %s'
                             LOG.debug(msg, self.server['id'])
                 # re-raise the original ssh timeout exception
-                six.reraise(*original_exception)
+                raise original_exception
             finally:
                 # Delete the traceback to avoid circular references
                 _, _, trace = original_exception
diff --git a/manila_tempest_tests/common/waiters.py b/manila_tempest_tests/common/waiters.py
index 5d8d344..056dab6 100644
--- a/manila_tempest_tests/common/waiters.py
+++ b/manila_tempest_tests/common/waiters.py
@@ -15,7 +15,6 @@
 
 import time
 
-import six
 from tempest import config
 from tempest.lib import exceptions
 
@@ -137,7 +136,7 @@
                            'dest': dest_host,
                            'share_id': share['id'],
                            'timeout': client.build_timeout,
-                           'status': six.text_type(statuses),
+                           'status': str(statuses),
                        })
             raise exceptions.TimeoutException(message)
     return share
diff --git a/manila_tempest_tests/config.py b/manila_tempest_tests/config.py
index bb35558..92cf7ba 100644
--- a/manila_tempest_tests/config.py
+++ b/manila_tempest_tests/config.py
@@ -21,6 +21,15 @@
                              help="Whether or not manila is expected to be "
                                   "available")
 
+manila_scope_enforcement = cfg.BoolOpt('manila',
+                                       default=False,
+                                       help="Does the Share service API "
+                                            "policies enforce scope? "
+                                            "This configuration value should "
+                                            "be same as manila.conf: "
+                                            "[oslo_policy].enforce_scope "
+                                            "option.")
+
 share_group = cfg.OptGroup(name="share", title="Share Service Options")
 
 ShareGroup = [
@@ -31,7 +40,7 @@
                     "This value is only used to validate the versions "
                     "response from Manila."),
     cfg.StrOpt("max_api_microversion",
-               default="2.61",
+               default="2.65",
                help="The maximum api microversion is configured to be the "
                     "value of the latest microversion supported by Manila."),
     cfg.StrOpt("region",
diff --git a/manila_tempest_tests/plugin.py b/manila_tempest_tests/plugin.py
index 0c32ce1..148a368 100644
--- a/manila_tempest_tests/plugin.py
+++ b/manila_tempest_tests/plugin.py
@@ -33,6 +33,8 @@
     def register_opts(self, conf):
         conf.register_opt(config_share.service_option,
                           group='service_available')
+        conf.register_opt(config_share.manila_scope_enforcement,
+                          group='enforce_scope')
         conf.register_group(config_share.share_group)
         conf.register_opts(config_share.ShareGroup, group='share')
 
@@ -54,7 +56,8 @@
 
     def get_opt_lists(self):
         return [(config_share.share_group.name, config_share.ShareGroup),
-                ('service_available', [config_share.service_option])]
+                ('service_available', [config_share.service_option]),
+                ('enforce_scope', [config_share.manila_scope_enforcement])]
 
     def get_service_clients(self):
         shares_config = config.service_client_config('share')
diff --git a/manila_tempest_tests/services/share/json/shares_client.py b/manila_tempest_tests/services/share/json/shares_client.py
index 770bbb9..3413387 100644
--- a/manila_tempest_tests/services/share/json/shares_client.py
+++ b/manila_tempest_tests/services/share/json/shares_client.py
@@ -15,9 +15,8 @@
 
 import json
 import time
+from urllib import parse as urlparse
 
-import six
-from six.moves.urllib import parse as urlparse
 from tempest import config
 from tempest.lib.common import rest_client
 from tempest.lib.common.utils import data_utils
@@ -322,7 +321,7 @@
                 self.show_share_server, kwargs.get("server_id"))
         else:
             raise share_exceptions.InvalidResource(
-                message=six.text_type(kwargs))
+                message=str(kwargs))
 
     def _is_resource_deleted(self, func, res_id, **kwargs):
         try:
diff --git a/manila_tempest_tests/services/share/v2/json/shares_client.py b/manila_tempest_tests/services/share/v2/json/shares_client.py
index d113ca7..293c24a 100644
--- a/manila_tempest_tests/services/share/v2/json/shares_client.py
+++ b/manila_tempest_tests/services/share/v2/json/shares_client.py
@@ -16,8 +16,8 @@
 import json
 import re
 import time
+from urllib import parse
 
-from six.moves.urllib import parse
 from tempest import config
 from tempest.lib.common import rest_client
 from tempest.lib.common.utils import data_utils
@@ -243,9 +243,11 @@
                      metadata=None, share_network_id=None,
                      share_type_id=None, is_public=False,
                      share_group_id=None, availability_zone=None,
-                     version=LATEST_MICROVERSION, experimental=False):
+                     version=LATEST_MICROVERSION, experimental=False,
+                     scheduler_hints=None):
         headers = EXPERIMENTAL if experimental else None
         metadata = metadata or {}
+        scheduler_hints = scheduler_hints or {}
         if name is None:
             name = data_utils.rand_name("tempest-created-share")
         if description is None:
@@ -275,6 +277,9 @@
             post_body["share"]["share_type"] = share_type_id
         if share_group_id:
             post_body["share"]["share_group_id"] = share_group_id
+        if scheduler_hints:
+            post_body["share"]["scheduler_hints"] = scheduler_hints
+
         body = json.dumps(post_body)
         resp, body = self.post("shares", body, headers=headers,
                                extra_headers=experimental, version=version)
@@ -1523,8 +1528,6 @@
                                version=version)
         return rest_client.ResponseBody(resp, body)
 
-################
-
     def create_share_replica(self, share_id, availability_zone=None,
                              version=LATEST_MICROVERSION):
         """Add a share replica of an existing share."""
diff --git a/manila_tempest_tests/tests/api/admin/test_export_locations.py b/manila_tempest_tests/tests/api/admin/test_export_locations.py
index 7d09f69..db382f2 100644
--- a/manila_tempest_tests/tests/api/admin/test_export_locations.py
+++ b/manila_tempest_tests/tests/api/admin/test_export_locations.py
@@ -16,7 +16,6 @@
 import ddt
 from oslo_utils import timeutils
 from oslo_utils import uuidutils
-import six
 from tempest import config
 from tempest.lib import decorators
 from testtools import testcase as tc
@@ -91,7 +90,7 @@
             # Check the format of ever-present summary keys
             self.assertTrue(uuidutils.is_uuid_like(export_location['id']))
             self.assertIsInstance(export_location['path'],
-                                  six.string_types)
+                                  str)
 
             if utils.is_microversion_ge(version, '2.14'):
                 self.assertIn(export_location['preferred'], (True, False))
diff --git a/manila_tempest_tests/tests/api/admin/test_replication.py b/manila_tempest_tests/tests/api/admin/test_replication.py
index b5b340c..853471c 100644
--- a/manila_tempest_tests/tests/api/admin/test_replication.py
+++ b/manila_tempest_tests/tests/api/admin/test_replication.py
@@ -83,6 +83,7 @@
         return [replica['id'] for replica in replica_list
                 if replica['replica_state'] == r_state]
 
+    @decorators.unstable_test(bug='1631314')
     @decorators.idempotent_id('0213cdfd-6a0f-4f24-a154-69796888a64a')
     @tc.attr(base.TAG_POSITIVE, base.TAG_BACKEND)
     @ddt.data(
@@ -211,6 +212,7 @@
             self.admin_client, replica['id'], constants.STATUS_ERROR,
             resource_name='share_replica', status_attr='replica_state')
 
+    @decorators.unstable_test(bug='1631314')
     @decorators.idempotent_id('2969565a-85e8-4c61-9dfb-cc7f7ca9f6dd')
     @tc.attr(base.TAG_POSITIVE, base.TAG_BACKEND)
     @ddt.data(
diff --git a/manila_tempest_tests/tests/api/admin/test_share_servers.py b/manila_tempest_tests/tests/api/admin/test_share_servers.py
index fd553ff..b406a92 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_servers.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_servers.py
@@ -16,7 +16,6 @@
 import re
 
 import ddt
-import six
 from tempest import config
 from tempest.lib import decorators
 from tempest.lib import exceptions as lib_exc
@@ -120,7 +119,7 @@
         else:
             msg = ("Appropriate server was not found. Its share_network_data"
                    ": '%s'. List of servers: '%s'.") % (self.sn_name_and_id,
-                                                        six.text_type(servers))
+                                                        str(servers))
             raise lib_exc.NotFound(message=msg)
         search_opts = {"host": host}
         servers = self.shares_v2_client.list_share_servers(
@@ -226,8 +225,8 @@
 
         # If details are present they and their values should be only strings
         for k, v in details.items():
-            self.assertIsInstance(k, six.string_types)
-            self.assertIsInstance(v, six.string_types)
+            self.assertIsInstance(k, str)
+            self.assertIsInstance(v, str)
 
     @decorators.idempotent_id('2fdf8d29-3ab8-4424-b684-6253f45b9666')
     @tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
diff --git a/manila_tempest_tests/tests/api/admin/test_share_servers_migration.py b/manila_tempest_tests/tests/api/admin/test_share_servers_migration.py
index 98150b8..99d712c 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_servers_migration.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_servers_migration.py
@@ -389,6 +389,11 @@
             share, dest_host, dest_server_id, snapshot_id=snapshot_id,
             share_network_id=dest_share_network_id)
 
+        # Source share server is only deleted after Wallaby release (2.63).
+        if utils.is_microversion_gt(CONF.share.max_api_microversion, "2.63"):
+            self.admin_shares_client.wait_for_resource_deletion(
+                server_id=src_server_id)
+
     @decorators.idempotent_id('52e154eb-2d39-45af-b5c1-49ea569ab804')
     @tc.attr(base.TAG_POSITIVE, base.TAG_BACKEND)
     @ddt.data(True, False)
diff --git a/manila_tempest_tests/tests/api/admin/test_snapshot_export_locations.py b/manila_tempest_tests/tests/api/admin/test_snapshot_export_locations.py
index fca92c7..1c6a9b7 100644
--- a/manila_tempest_tests/tests/api/admin/test_snapshot_export_locations.py
+++ b/manila_tempest_tests/tests/api/admin/test_snapshot_export_locations.py
@@ -15,7 +15,6 @@
 
 import ddt
 from oslo_utils import uuidutils
-import six
 from tempest import config
 from tempest.lib import decorators
 from testtools import testcase as tc
@@ -94,7 +93,7 @@
             # Check the format of ever-present summary keys
             self.assertTrue(uuidutils.is_uuid_like(export_location['id']))
             self.assertIsInstance(export_location['path'],
-                                  six.string_types)
+                                  str)
 
             if role == 'admin':
                 self.assertIn(export_location['is_admin_only'], (True, False))
diff --git a/manila_tempest_tests/tests/api/admin/test_snapshot_manage_negative.py b/manila_tempest_tests/tests/api/admin/test_snapshot_manage_negative.py
index f2fb48f..36ddf7e 100644
--- a/manila_tempest_tests/tests/api/admin/test_snapshot_manage_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_snapshot_manage_negative.py
@@ -13,7 +13,7 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-import six
+
 from tempest import config
 from tempest.lib.common.utils import data_utils
 from tempest.lib import decorators
@@ -51,7 +51,7 @@
         cls.extra_specs = {
             'storage_protocol': CONF.share.capability_storage_protocol,
             'driver_handles_share_servers': CONF.share.multitenancy_enabled,
-            'snapshot_support': six.text_type(
+            'snapshot_support': str(
                 CONF.share.capability_snapshot_support),
         }
 
diff --git a/manila_tempest_tests/tests/api/admin/test_user_messages_negative.py b/manila_tempest_tests/tests/api/admin/test_user_messages_negative.py
index 197b883..e675387 100644
--- a/manila_tempest_tests/tests/api/admin/test_user_messages_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_user_messages_negative.py
@@ -10,7 +10,6 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 from oslo_utils import uuidutils
-import six
 from tempest import config
 from tempest.lib import decorators
 from tempest.lib import exceptions as lib_exc
@@ -47,7 +46,7 @@
     def test_show_nonexistent_message(self):
         self.assertRaises(lib_exc.NotFound,
                           self.shares_v2_client.get_message,
-                          six.text_type(uuidutils.generate_uuid()))
+                          str(uuidutils.generate_uuid()))
 
     @decorators.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
     @decorators.idempotent_id('2f5be1aa-974b-4f6a-ae3a-084578e64f82')
@@ -61,7 +60,7 @@
     def test_delete_nonexistent_message(self):
         self.assertRaises(lib_exc.NotFound,
                           self.shares_v2_client.delete_message,
-                          six.text_type(uuidutils.generate_uuid()))
+                          str(uuidutils.generate_uuid()))
 
     @decorators.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
     @utils.skip_if_microversion_not_supported(QUERY_BY_TIMESTAMP_MICROVERSION)
diff --git a/manila_tempest_tests/tests/api/base.py b/manila_tempest_tests/tests/api/base.py
index dd25062..648c9f8 100755
--- a/manila_tempest_tests/tests/api/base.py
+++ b/manila_tempest_tests/tests/api/base.py
@@ -18,7 +18,6 @@
 import traceback
 
 from oslo_log import log
-import six
 from tempest import config
 from tempest.lib.common import cred_client
 from tempest.lib.common.utils import data_utils
@@ -636,8 +635,8 @@
         extra_specs = {}
         for k, v in share_type['extra_specs'].items():
             extra_specs[k] = (
-                True if six.text_type(v).lower() == 'true'
-                else False if six.text_type(v).lower() == 'false' else v
+                True if str(v).lower() == 'true'
+                else False if str(v).lower() == 'false' else v
             )
         return [
             pool for pool in pools if all(y in pool['capabilities'].items()
@@ -1077,7 +1076,7 @@
     @staticmethod
     def add_extra_specs_to_dict(extra_specs=None):
         """Add any required extra-specs to share type dictionary"""
-        dhss = six.text_type(CONF.share.multitenancy_enabled)
+        dhss = str(CONF.share.multitenancy_enabled)
         extra_specs_dict = {"driver_handles_share_servers": dhss}
         if extra_specs:
             extra_specs_dict.update(extra_specs)
diff --git a/manila_tempest_tests/tests/api/test_replication_negative.py b/manila_tempest_tests/tests/api/test_replication_negative.py
index 90c52c7..e7d0e7d 100644
--- a/manila_tempest_tests/tests/api/test_replication_negative.py
+++ b/manila_tempest_tests/tests/api/test_replication_negative.py
@@ -137,6 +137,7 @@
                           self.shares_v2_client.delete_share,
                           self.share1["id"])
 
+    @decorators.unstable_test(bug='1631314')
     @decorators.idempotent_id('b9c2e57b-f1ae-475c-9d0b-df75dbe93b61')
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
     def test_promote_out_of_sync_share_replica(self):
diff --git a/manila_tempest_tests/tests/api/test_scheduler_hints.py b/manila_tempest_tests/tests/api/test_scheduler_hints.py
new file mode 100644
index 0000000..83e5a1a
--- /dev/null
+++ b/manila_tempest_tests/tests/api/test_scheduler_hints.py
@@ -0,0 +1,102 @@
+# Copyright 2021 Cloudification GmbH
+# All Rights Reserved.
+#
+#    Licensed under the Apache License, Version 2.0 (the "License"); you may
+#    not use this file except in compliance with the License. You may obtain
+#    a copy of the License at
+#
+#         http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+#    License for the specific language governing permissions and limitations
+#    under the License.
+
+from tempest import config
+from tempest.lib import decorators
+from testtools import testcase as tc
+
+from manila_tempest_tests.tests.api import base
+from manila_tempest_tests import utils
+
+CONF = config.CONF
+
+
+class SharesSchedulerHintsTest(base.BaseSharesMixedTest):
+
+    @classmethod
+    def skip_checks(cls):
+        super(SharesSchedulerHintsTest, cls).skip_checks()
+        if not CONF.share.multi_backend:
+            raise cls.skipException("Manila multi-backend is disabled.")
+        elif len(CONF.share.backend_names) < 2:
+            raise cls.skipException("For running multi-backend tests required"
+                                    " two names in config. Skipping.")
+        elif any(not name for name in CONF.share.backend_names):
+            raise cls.skipException("Share backend names can not be empty. "
+                                    "Skipping.")
+        utils.check_skip_if_microversion_not_supported('2.65')
+
+    @classmethod
+    def resource_setup(cls):
+        super(SharesSchedulerHintsTest, cls).resource_setup()
+        # create share type
+        cls.share_type = cls.create_share_type()
+        cls.share_type_id = cls.share_type['id']
+
+        # create share
+        cls.share_a = cls.create_share(share_type_id=cls.share_type_id)
+
+    @decorators.idempotent_id('f96d5836-bfc9-4c22-888e-3f62d731573c')
+    @tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
+    def test_same_host_scheduler_hint_in_share_creation(self):
+        scheduler_hint = {"same_host": "%s" % self.share_a["id"]}
+
+        # create share with metadata
+        share_b = self.create_share(share_type_id=self.share_type_id,
+                                    scheduler_hints=scheduler_hint,
+                                    cleanup_in_class=False)
+
+        # get backend of shares
+        share_a = self.admin_shares_v2_client.get_share(
+            self.share_a['id'])['share']
+        backend_a = share_a['host']
+        share_b = self.admin_shares_v2_client.get_share(
+            share_b['id'])['share']
+        backend_b = share_b['host']
+
+        # verify same backends
+        self.assertEqual(backend_a, backend_b)
+
+        # get metadata of share
+        metadata_a = self.shares_client.get_metadata(
+            self.share_a["id"])['metadata']
+        md_a = {"__affinity_same_host": "%s" % share_b["id"]}
+        metadata_b = self.shares_client.get_metadata(
+            share_b["id"])['metadata']
+        md_b = {"__affinity_same_host": "%s" % self.share_a["id"]}
+
+        # verify metadata
+        self.assertEqual(md_a, metadata_a)
+        self.assertEqual(md_b, metadata_b)
+
+    @decorators.idempotent_id('6569e0c3-43c9-4ee2-84ff-ea7fa8da8110')
+    @tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
+    def test_different_host_scheduler_hint_in_share_creation(self):
+        scheduler_hint = {"different_host": "%s" % self.share_a["id"]}
+
+        # create share with metadata
+        share_c = self.create_share(share_type_id=self.share_type_id,
+                                    scheduler_hints=scheduler_hint,
+                                    cleanup_in_class=False)
+
+        # get backend of shares
+        share_a = self.admin_shares_v2_client.get_share(
+            self.share_a['id'])['share']
+        backend_a = share_a['host']
+        share_c = self.admin_shares_v2_client.get_share(share_c['id'])['share']
+        backend_c = share_c['host']
+
+        # verify different backends
+        self.assertNotEqual(backend_a, backend_c)
diff --git a/manila_tempest_tests/tests/api/test_scheduler_hints_negative.py b/manila_tempest_tests/tests/api/test_scheduler_hints_negative.py
new file mode 100644
index 0000000..c6c75f7
--- /dev/null
+++ b/manila_tempest_tests/tests/api/test_scheduler_hints_negative.py
@@ -0,0 +1,73 @@
+# Copyright 2021 Cloudification GmbH
+# All Rights Reserved.
+#
+#    Licensed under the Apache License, Version 2.0 (the "License"); you may
+#    not use this file except in compliance with the License. You may obtain
+#    a copy of the License at
+#
+#         http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+#    License for the specific language governing permissions and limitations
+#    under the License.
+
+from tempest import config
+from tempest.lib import decorators
+from tempest.lib import exceptions as lib_exc
+from testtools import testcase as tc
+
+from manila_tempest_tests import share_exceptions
+from manila_tempest_tests.tests.api import base
+from manila_tempest_tests import utils
+
+FAKE_SHARE_ID = "2d316e9f-39fc-468e-b2d9-634b25ae85f6"
+CONF = config.CONF
+
+
+class SharesSchedulerHintsNegativeTest(base.BaseSharesMixedTest):
+
+    @classmethod
+    def skip_checks(cls):
+        super(SharesSchedulerHintsNegativeTest, cls).skip_checks()
+        if not CONF.share.multi_backend:
+            raise cls.skipException("Manila multi-backend is disabled.")
+        elif len(CONF.share.backend_names) < 2:
+            raise cls.skipException("For running multi-backend tests required"
+                                    " two names in config. Skipping.")
+        elif any(not name for name in CONF.share.backend_names):
+            raise cls.skipException("Share backend names can not be empty. "
+                                    "Skipping.")
+        utils.check_skip_if_microversion_not_supported('2.65')
+
+    @classmethod
+    def resource_setup(cls):
+        super(SharesSchedulerHintsNegativeTest, cls).resource_setup()
+        # create share type
+        cls.share_type = cls.create_share_type()
+        cls.share_type_id = cls.share_type['id']
+
+        # create share
+        cls.share_a = cls.create_share(share_type_id=cls.share_type_id)
+
+    @decorators.idempotent_id('2228a187-4f03-4195-9e23-fa1a42110fdc')
+    @tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
+    def test_scheduler_hint_with_invalid_share_id(self):
+        scheduler_hint = {"same_host": FAKE_SHARE_ID}
+        self.assertRaises(lib_exc.NotFound,
+                          self.create_share,
+                          share_type_id=self.share_type_id,
+                          scheduler_hints=scheduler_hint,
+                          cleanup_in_class=False)
+
+    @decorators.idempotent_id('6f0c5561-8a6a-4cfb-bbe7-84ffc39bf78d')
+    @tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
+    def test_scheduler_hint_with_invalid_hint(self):
+        scheduler_hint = {"same_host": "%s" % self.share_a["id"],
+                          "different_host": "%s" % self.share_a["id"]}
+        self.assertRaises(share_exceptions.ShareBuildErrorException,
+                          self.create_share,
+                          share_type_id=self.share_type_id,
+                          scheduler_hints=scheduler_hint,
+                          cleanup_in_class=False)
diff --git a/manila_tempest_tests/tests/api/test_security_services.py b/manila_tempest_tests/tests/api/test_security_services.py
index 5bfbc2e..24d8bad 100644
--- a/manila_tempest_tests/tests/api/test_security_services.py
+++ b/manila_tempest_tests/tests/api/test_security_services.py
@@ -15,7 +15,6 @@
 
 import ddt
 from oslo_log import log
-import six
 from tempest import config
 from tempest.lib import decorators
 import testtools
@@ -252,7 +251,7 @@
             LOG.warning("Caught exception. It is expected in case backend "
                         "fails having security-service with improper data "
                         "that leads to share-server creation error. "
-                        "%s", six.text_type(e))
+                        "%s", str(e))
 
         update_data = {
             "name": "name",
diff --git a/manila_tempest_tests/tests/api/test_security_services_mapping_negative.py b/manila_tempest_tests/tests/api/test_security_services_mapping_negative.py
index 9aaf20b..d0bb321 100644
--- a/manila_tempest_tests/tests/api/test_security_services_mapping_negative.py
+++ b/manila_tempest_tests/tests/api/test_security_services_mapping_negative.py
@@ -14,7 +14,6 @@
 #    under the License.
 
 from oslo_log import log
-import six
 from tempest import config
 from tempest.lib import decorators
 from tempest.lib import exceptions as lib_exc
@@ -136,7 +135,7 @@
             LOG.warning("Caught exception. It is expected in case backend "
                         "fails having security-service with improper data "
                         "that leads to share-server creation error. "
-                        "%s", six.text_type(e))
+                        "%s", str(e))
 
         self.assertRaises(lib_exc.Forbidden,
                           self.cl.remove_sec_service_from_share_network,
diff --git a/manila_tempest_tests/tests/api/test_security_services_negative.py b/manila_tempest_tests/tests/api/test_security_services_negative.py
index 3895fa9..08e3c7b 100644
--- a/manila_tempest_tests/tests/api/test_security_services_negative.py
+++ b/manila_tempest_tests/tests/api/test_security_services_negative.py
@@ -14,7 +14,6 @@
 #    under the License.
 
 from oslo_log import log
-import six
 from tempest import config
 from tempest.lib import decorators
 from tempest.lib import exceptions as lib_exc
@@ -120,7 +119,7 @@
             LOG.warning("Caught exception. It is expected in case backend "
                         "fails having security-service with improper data "
                         "that leads to share-server creation error. "
-                        "%s", six.text_type(e))
+                        "%s", str(e))
 
         self.assertRaises(lib_exc.Forbidden,
                           self.shares_client.update_security_service,
diff --git a/manila_tempest_tests/tests/api/test_shares_actions.py b/manila_tempest_tests/tests/api/test_shares_actions.py
index 4cdc70d..3232d50 100644
--- a/manila_tempest_tests/tests/api/test_shares_actions.py
+++ b/manila_tempest_tests/tests/api/test_shares_actions.py
@@ -14,7 +14,6 @@
 #    under the License.
 
 import ddt
-import six
 from tempest import config
 from tempest.lib.common.utils import data_utils
 from tempest.lib import decorators
@@ -93,7 +92,7 @@
 
         # get share
         share = self.shares_v2_client.get_share(
-            self.shares[0]['id'], version=six.text_type(version))['share']
+            self.shares[0]['id'], version=str(version))['share']
 
         # verify keys
         expected_keys = [
@@ -125,13 +124,13 @@
         # verify values
         msg = "Expected name: '%s', actual name: '%s'" % (self.share_name,
                                                           share["name"])
-        self.assertEqual(self.share_name, six.text_type(share["name"]), msg)
+        self.assertEqual(self.share_name, str(share["name"]), msg)
 
         msg = ("Expected description: '%s', "
                "actual description: '%s'" % (self.share_desc,
                                              share["description"]))
         self.assertEqual(
-            self.share_desc, six.text_type(share["description"]), msg)
+            self.share_desc, str(share["description"]), msg)
 
         msg = "Expected size: '%s', actual size: '%s'" % (
             CONF.share.share_size, share["size"])
@@ -211,7 +210,7 @@
 
         # list shares
         shares = self.shares_v2_client.list_shares_with_detail(
-            version=six.text_type(version))['shares']
+            version=str(version))['shares']
 
         # verify keys
         keys = [
diff --git a/manila_tempest_tests/tests/api/test_snapshot_rules.py b/manila_tempest_tests/tests/api/test_snapshot_rules.py
index 541e861..74d5221 100644
--- a/manila_tempest_tests/tests/api/test_snapshot_rules.py
+++ b/manila_tempest_tests/tests/api/test_snapshot_rules.py
@@ -14,7 +14,6 @@
 #    under the License.
 
 import ddt
-import six
 from tempest import config
 from tempest.lib import decorators
 from testtools import testcase as tc
@@ -54,7 +53,7 @@
             access_to)['snapshot_access']
 
         for key in ('deleted', 'deleted_at', 'instance_mappings'):
-            self.assertNotIn(key, list(six.iterkeys(rule)))
+            self.assertNotIn(key, list(rule.keys()))
 
         waiters.wait_for_resource_status(
             self.shares_v2_client, self.snapshot['id'], 'active',
diff --git a/manila_tempest_tests/tests/scenario/manager.py b/manila_tempest_tests/tests/scenario/manager.py
index 1fa03f4..947d0e6 100644
--- a/manila_tempest_tests/tests/scenario/manager.py
+++ b/manila_tempest_tests/tests/scenario/manager.py
@@ -20,7 +20,6 @@
 from oslo_log import log
 from oslo_utils import netutils
 from oslo_utils import uuidutils
-import six
 from tempest.common import compute
 from tempest.common import image as common_image
 from tempest.common.utils.linux import remote_client
@@ -630,7 +629,7 @@
             try:
                 return subnets_client.create_subnet(**subnet)
             except lib_exc.Conflict as e:
-                if 'overlaps with another subnet' not in six.text_type(e):
+                if 'overlaps with another subnet' not in str(e):
                     raise
 
         result = None
diff --git a/manila_tempest_tests/tests/scenario/manager_share.py b/manila_tempest_tests/tests/scenario/manager_share.py
index 2e40569..657b1f1 100644
--- a/manila_tempest_tests/tests/scenario/manager_share.py
+++ b/manila_tempest_tests/tests/scenario/manager_share.py
@@ -14,10 +14,9 @@
 #    under the License.
 
 from tempfile import mkstemp
+from urllib.request import urlopen
 
 from oslo_log import log
-import six
-from six.moves.urllib.request import urlopen
 from tempest.common import waiters
 from tempest import config
 from tempest.lib.common.utils import data_utils
@@ -198,7 +197,6 @@
         # NOTE(u_glide): Workaround for bug #1465682
         remote_client = remote_client.ssh_client
 
-        self.share = self.shares_client.get_share(self.share['id'])['share']
         return remote_client
 
     def validate_ping_to_export_location(self, export, remote_client,
@@ -278,8 +276,8 @@
             kwargs.update({'share_type_id': default_share_type_id})
         if CONF.share.multitenancy_enabled:
             kwargs.update({'share_network_id': self.share_network['id']})
-        self.share = self._create_share(**kwargs)
-        return self.share
+        share = self._create_share(**kwargs)
+        return share
 
     def get_remote_client(self, *args, **kwargs):
         if not CONF.share.image_with_share_tools:
@@ -289,7 +287,7 @@
         # original implementation depends on CONF.compute.ssh_auth_method
         # option.
         server_or_ip = kwargs['server_or_ip']
-        if isinstance(server_or_ip, six.string_types):
+        if isinstance(server_or_ip, str):
             ip = server_or_ip
         else:
             addr = server_or_ip['addresses'][
@@ -357,7 +355,6 @@
                                                    snapshot=None,
                                                    access_level='rw',
                                                    client=None):
-        share = share or self.share
         client = client or self.shares_v2_client
         if not CONF.share.multitenancy_enabled:
             if self.ipv6_enabled and not self.storage_network:
@@ -406,7 +403,6 @@
         """
         client = client or self.shares_v2_client
         if not access_rule:
-            share = share or self.share
             access_to = access_to or data_utils.rand_name(
                 self.__class__.__name__ + '-cephx-id')
             # Check if access is already granted to the client
@@ -746,9 +742,10 @@
 
     def allow_access(self, access_level='rw', **kwargs):
         snapshot = kwargs.get('snapshot')
+        share = kwargs.get('share')
         return self._provide_access_to_client_identified_by_ip(
-            instance=kwargs['instance'], access_level=access_level,
-            snapshot=snapshot)
+            share=share, instance=kwargs['instance'],
+            access_level=access_level, snapshot=snapshot)
 
     def mount_share(self, location, ssh_client, target_dir=None):
 
@@ -772,9 +769,11 @@
             raise cls.skipException(message)
 
     def allow_access(self, access_level='rw', **kwargs):
+        share = kwargs.get('share')
         snapshot = kwargs.get('snapshot')
         return self._provide_access_to_client_identified_by_ip(
             instance=kwargs['instance'],
+            share=share,
             snapshot=snapshot,
             access_level=access_level)
 
@@ -794,7 +793,7 @@
 
     def allow_access(self, access_level='rw', access_rule=None, **kwargs):
         return self._provide_access_to_client_identified_by_cephx(
-            remote_client=kwargs['remote_client'],
+            share=kwargs['share'], remote_client=kwargs['remote_client'],
             locations=kwargs['locations'], access_level=access_level,
             access_rule=access_rule)
 
diff --git a/manila_tempest_tests/tests/scenario/test_share_basic_ops.py b/manila_tempest_tests/tests/scenario/test_share_basic_ops.py
index e440cb3..d832974 100644
--- a/manila_tempest_tests/tests/scenario/test_share_basic_ops.py
+++ b/manila_tempest_tests/tests/scenario/test_share_basic_ops.py
@@ -49,12 +49,12 @@
     @tc.attr(base.TAG_POSITIVE, base.TAG_BACKEND)
     def test_mount_share_one_vm(self):
         instance = self.boot_instance(wait_until="BUILD")
-        self.create_share()
-        locations = self.get_user_export_locations(self.share)
+        share = self.create_share()
+        locations = self.get_user_export_locations(share)
         instance = self.wait_for_active_instance(instance["id"])
         remote_client = self.init_remote_client(instance)
-        self.allow_access(instance=instance, remote_client=remote_client,
-                          locations=locations)
+        self.allow_access(share=share, instance=instance,
+                          remote_client=remote_client, locations=locations)
 
         for location in locations:
             self.mount_share(location, remote_client)
@@ -67,23 +67,24 @@
         test_data = "Some test data to write"
 
         instance = self.boot_instance(wait_until="BUILD")
-        self.create_share()
-        location = self.get_user_export_locations(self.share)[0]
+        share = self.create_share()
+        location = self.get_user_export_locations(share)[0]
         instance = self.wait_for_active_instance(instance["id"])
 
         remote_client_inst = self.init_remote_client(instance)
 
         # First, check if write works RW access.
         acc_rule_id = self.allow_access(
-            instance=instance, remote_client=remote_client_inst,
+            share=share, instance=instance, remote_client=remote_client_inst,
             locations=location)['id']
 
         self.mount_share(location, remote_client_inst)
         self.write_data_to_mounted_share(test_data, remote_client_inst)
-        self.deny_access(self.share['id'], acc_rule_id)
+        self.deny_access(share['id'], acc_rule_id)
 
-        self.allow_access(instance=instance, remote_client=remote_client_inst,
-                          locations=location, access_level='ro')
+        self.allow_access(share=share, instance=instance,
+                          remote_client=remote_client_inst, locations=location,
+                          access_level='ro')
 
         self.addCleanup(self.unmount_share, remote_client_inst)
 
@@ -101,14 +102,14 @@
         # Boot two VMs and create share
         instance1 = self.boot_instance(wait_until="BUILD")
         instance2 = self.boot_instance(wait_until="BUILD")
-        self.create_share()
-        location = self.get_user_export_locations(self.share)[0]
+        share = self.create_share()
+        location = self.get_user_export_locations(share)[0]
         instance1 = self.wait_for_active_instance(instance1["id"])
         instance2 = self.wait_for_active_instance(instance2["id"])
 
         # Write data to first VM
         remote_client_inst1 = self.init_remote_client(instance1)
-        access = self.allow_access(instance=instance1,
+        access = self.allow_access(share=share, instance=instance1,
                                    remote_client=remote_client_inst1,
                                    locations=location)
 
@@ -120,7 +121,7 @@
         # Read from second VM
         remote_client_inst2 = self.init_remote_client(instance2)
         if not CONF.share.override_ip_for_nfs_access or self.ipv6_enabled:
-            self.allow_access(instance=instance2,
+            self.allow_access(share=share, instance=instance2,
                               remote_client=remote_client_inst2,
                               locations=location,
                               access_rule=access)
@@ -164,17 +165,15 @@
                                      "needed to run share migration tests.")
 
         instance = self.boot_instance(wait_until="BUILD")
-        self.create_share()
-        export_location = self.get_user_export_locations(self.share)[0]
+        share = self.create_share()
+        export_location = self.get_user_export_locations(share)[0]
         instance = self.wait_for_active_instance(instance["id"])
-        self.share = self.shares_admin_v2_client.get_share(
-            self.share['id'])['share']
+        share = self.shares_admin_v2_client.get_share(share['id'])['share']
 
         default_type = self.shares_v2_client.list_share_types(
             default=True)['share_type']
 
-        dest_pool = utils.choose_matching_backend(
-            self.share, pools, default_type)
+        dest_pool = utils.choose_matching_backend(share, pools, default_type)
 
         self.assertIsNotNone(dest_pool)
         self.assertIsNotNone(dest_pool.get('name'))
@@ -183,7 +182,8 @@
 
         remote_client = self.init_remote_client(instance)
 
-        self.allow_access(instance=instance,
+        self.allow_access(share=share,
+                          instance=instance,
                           remote_client=remote_client,
                           locations=export_location)
 
@@ -212,8 +212,8 @@
                       if force_host_assisted
                       else constants.TASK_STATE_MIGRATION_DRIVER_PHASE1_DONE)
 
-        self.share = self.migrate_share(
-            self.share['id'], dest_pool, task_state, force_host_assisted)
+        share = self.migrate_share(
+            share['id'], dest_pool, task_state, force_host_assisted)
 
         if force_host_assisted:
             self.assertRaises(
@@ -223,13 +223,13 @@
 
         self.unmount_share(remote_client)
 
-        self.share = self.migration_complete(self.share['id'], dest_pool)
+        share = self.migration_complete(share['id'], dest_pool)
 
-        new_exports = self.get_user_export_locations(self.share)
+        new_exports = self.get_user_export_locations(share)
 
-        self.assertEqual(dest_pool, self.share['host'])
+        self.assertEqual(dest_pool, share['host'])
         self.assertEqual(constants.TASK_STATE_MIGRATION_SUCCESS,
-                         self.share['task_state'])
+                         share['task_state'])
 
         self.mount_share(new_exports[0], remote_client)
 
@@ -266,7 +266,8 @@
         remote_client = self.init_remote_client(instance)
 
         # 4 - Provide RW access to S1, ok, provided
-        self.allow_access(instance=instance,
+        self.allow_access(share=parent_share,
+                          instance=instance,
                           remote_client=remote_client,
                           locations=parent_share_export_location)
 
@@ -307,7 +308,8 @@
         )
 
         # 11 - Provide RW access to S2, ok, provided
-        self.allow_access(instance=instance,
+        self.allow_access(share=child_share,
+                          instance=instance,
                           remote_client=remote_client,
                           locations=child_share_export_location)
 
@@ -364,7 +366,8 @@
         remote_client = self.init_remote_client(instance)
 
         # 4 - Provide RW access to S1, ok, provided
-        self.allow_access(instance=instance,
+        self.allow_access(share=parent_share,
+                          instance=instance,
                           remote_client=remote_client,
                           locations=user_export_location)
 
@@ -390,7 +393,8 @@
         remote_client.exec_command("sudo touch %s/file2" % parent_share_dir)
 
         # 9 - Allow access to SS1
-        self.allow_access(instance=instance,
+        self.allow_access(share=parent_share,
+                          instance=instance,
                           snapshot=snapshot,
                           remote_client=remote_client,
                           locations=snapshot_export_location)
diff --git a/manila_tempest_tests/tests/scenario/test_share_extend.py b/manila_tempest_tests/tests/scenario/test_share_extend.py
index 4b74f78..d6a23d0 100644
--- a/manila_tempest_tests/tests/scenario/test_share_extend.py
+++ b/manila_tempest_tests/tests/scenario/test_share_extend.py
@@ -13,7 +13,6 @@
 import ddt
 from oslo_log import log as logging
 from oslo_utils import units
-import six
 from tempest import config
 from tempest.lib import decorators
 from tempest.lib import exceptions
@@ -65,8 +64,8 @@
 
         LOG.debug('Step 4 - grant access')
         location = self.get_user_export_locations(share)[0]
-        self.allow_access(instance=instance, remote_client=remote_client,
-                          locations=location)
+        self.allow_access(share=share, instance=instance,
+                          remote_client=remote_client, locations=location)
 
         LOG.debug('Step 5 - mount')
         self.mount_share(location, remote_client)
@@ -133,7 +132,7 @@
                                                       block_count,
                                                       '/dev/urandom')
         except exceptions.SSHExecCommandFailed as e:
-            if 'stale file handle' in six.text_type(e).lower():
+            if 'stale file handle' in str(e).lower():
                 LOG.warning("Client was disconnected during extend process")
                 self.unmount_share(remote_client)
                 self.mount_share(mount_location, remote_client)
diff --git a/manila_tempest_tests/tests/scenario/test_share_manage_unmanage.py b/manila_tempest_tests/tests/scenario/test_share_manage_unmanage.py
index 7f4833d..ef2a6af 100644
--- a/manila_tempest_tests/tests/scenario/test_share_manage_unmanage.py
+++ b/manila_tempest_tests/tests/scenario/test_share_manage_unmanage.py
@@ -123,7 +123,7 @@
         self.assertRaises(
             exceptions.NotFound,
             self.shares_admin_v2_client.get_share,
-            self.share['id'])
+            share['id'])
 
         LOG.debug('Step 10 - manage share')
         share_type = self.get_share_type()
diff --git a/manila_tempest_tests/tests/scenario/test_share_shrink.py b/manila_tempest_tests/tests/scenario/test_share_shrink.py
index 2b68d8a..a4e59e8 100644
--- a/manila_tempest_tests/tests/scenario/test_share_shrink.py
+++ b/manila_tempest_tests/tests/scenario/test_share_shrink.py
@@ -13,7 +13,6 @@
 import time
 
 from oslo_log import log as logging
-import six
 from tempest import config
 from tempest.lib import decorators
 from tempest.lib import exceptions
@@ -69,8 +68,8 @@
 
         LOG.debug('Step 4 - grant access')
         location = self.get_user_export_locations(share)[0]
-        self.allow_access(instance=instance, remote_client=remote_client,
-                          locations=location)
+        self.allow_access(share=share, instance=instance,
+                          remote_client=remote_client, locations=location)
 
         LOG.debug('Step 5 - mount')
         self.mount_share(location, remote_client)
@@ -146,7 +145,7 @@
                                                        new_size=new_size)
                 except exceptions.BadRequest as e:
                     if ('New size for shrink must be less than current size'
-                            in six.text_type(e)):
+                            in str(e)):
                         break
 
             time.sleep(check_interval)
diff --git a/manila_tempest_tests/utils.py b/manila_tempest_tests/utils.py
index 7625460..d0860f0 100644
--- a/manila_tempest_tests/utils.py
+++ b/manila_tempest_tests/utils.py
@@ -18,7 +18,6 @@
 import re
 
 from netaddr import ip
-import six
 from tempest import config
 import testtools
 
@@ -110,12 +109,12 @@
     conflicts in real-world testing.
     """
     test_net_3 = '203.0.113.'
-    address = test_net_3 + six.text_type(random.randint(0, 255))
+    address = test_net_3 + str(random.randint(0, 255))
     if network:
-        mask_length = six.text_type(random.randint(24, 32))
+        mask_length = str(random.randint(24, 32))
         address = '/'.join((address, mask_length))
         ip_network = ip.IPNetwork(address)
-        return '/'.join((six.text_type(ip_network.network), mask_length))
+        return '/'.join((str(ip_network.network), mask_length))
     return address
 
 
@@ -124,10 +123,10 @@
     ran_add = ["%x" % random.randrange(0, 16 ** 4) for i in range(6)]
     address = "2001:0DB8:" + ":".join(ran_add)
     if network:
-        mask_length = six.text_type(random.randint(32, 128))
+        mask_length = str(random.randint(32, 128))
         address = '/'.join((address, mask_length))
         ip_network = ip.IPNetwork(address)
-        return '/'.join((six.text_type(ip_network.network), mask_length))
+        return '/'.join((str(ip_network.network), mask_length))
     return address
 
 
@@ -135,8 +134,8 @@
     extra_specs = {}
     # fix extra specs with string values instead of boolean
     for k, v in share_type['extra_specs'].items():
-        extra_specs[k] = (True if six.text_type(v).lower() == 'true'
-                          else False if six.text_type(v).lower() == 'false'
+        extra_specs[k] = (True if str(v).lower() == 'true'
+                          else False if str(v).lower() == 'false'
                           else v)
     selected_pool = next(
         (x for x in pools if (x['name'] != share['host'] and all(
diff --git a/releasenotes/notes/bug-1631314-1509db08c75ff645.yaml b/releasenotes/notes/bug-1631314-1509db08c75ff645.yaml
new file mode 100644
index 0000000..601ff57
--- /dev/null
+++ b/releasenotes/notes/bug-1631314-1509db08c75ff645.yaml
@@ -0,0 +1,5 @@
+---
+fixes:
+  - |
+    `Bug #1631314 <https://bugs.launchpad.net/manila/+bug/1631314>`_:
+    Fixed an issue on unstable replication tests.
diff --git a/zuul.d/manila-tempest-jobs.yaml b/zuul.d/manila-tempest-jobs.yaml
index f31ff11..494b285 100644
--- a/zuul.d/manila-tempest-jobs.yaml
+++ b/zuul.d/manila-tempest-jobs.yaml
@@ -60,6 +60,8 @@
     required-projects: *manila-tempest-required-projects
     vars:
       <<: *manila-tempest-base-vars
+      # NOTE(gouthamr): Disabled until https://launchpad.net/bugs/1940324 is
+      # fixed.
       tempest_exclude_regex: "(^manila_tempest_tests.tests.scenario.*IPv6.*)"
 
 - job:
diff --git a/zuul.d/manila-tempest-stable-jobs.yaml b/zuul.d/manila-tempest-stable-jobs.yaml
index ff74f5d..3d2447e 100644
--- a/zuul.d/manila-tempest-stable-jobs.yaml
+++ b/zuul.d/manila-tempest-stable-jobs.yaml
@@ -1,6 +1,16 @@
 # Stable branch jobs to test the trunk version of manila-tempest-plugin against
 # released stable branches of manila
 - job:
+    name: manila-tempest-plugin-lvm-xena
+    parent: manila-tempest-plugin-lvm
+    override-checkout: stable/xena
+    nodeset: openstack-single-node-focal
+    vars:
+        # NOTE(gouthamr): Disabled until https://launchpad.net/bugs/1940324 is
+        # fixed.
+        tempest_exclude_regex: "(^manila_tempest_tests.tests.scenario.*IPv6.*)"
+
+- job:
     name: manila-tempest-plugin-lvm-wallaby
     parent: manila-tempest-plugin-lvm
     override-checkout: stable/wallaby
@@ -15,11 +25,3 @@
     nodeset: openstack-single-node-focal
     vars:
         tempest_exclude_regex: ''
-
-- job:
-    name: manila-tempest-plugin-lvm-ussuri
-    parent: manila-tempest-plugin-lvm
-    override-checkout: stable/ussuri
-    nodeset: openstack-single-node-bionic
-    vars:
-        tempest_exclude_regex: ''
diff --git a/zuul.d/project.yaml b/zuul.d/project.yaml
index bfeaa7b..ce21547 100644
--- a/zuul.d/project.yaml
+++ b/zuul.d/project.yaml
@@ -7,9 +7,9 @@
         - manila-tempest-plugin-dummy-no-dhss
         - manila-tempest-plugin-dummy-dhss
         - manila-tempest-plugin-lvm
+        - manila-tempest-plugin-lvm-xena
         - manila-tempest-plugin-lvm-wallaby
         - manila-tempest-plugin-lvm-victoria
-        - manila-tempest-plugin-lvm-ussuri
         - manila-tempest-plugin-zfsonlinux:
             voting: false
         - manila-tempest-plugin-cephfs-native: