Merge "Only return share host for admins using shares API"
diff --git a/manila_tempest_tests/tests/api/base.py b/manila_tempest_tests/tests/api/base.py
index c84e513..260e85d 100644
--- a/manila_tempest_tests/tests/api/base.py
+++ b/manila_tempest_tests/tests/api/base.py
@@ -671,7 +671,8 @@
     def get_pools_for_replication_domain(self):
         # Get the list of pools for the replication domain
         pools = self.admin_client.list_pools(detail=True)['pools']
-        instance_host = self.shares[0]['host']
+        instance_host = self.admin_client.get_share(
+            self.shares[0]['id'])['host']
         host_pool = [p for p in pools if p['name'] == instance_host][0]
         rep_domain = host_pool['capabilities']['replication_domain']
         pools_in_rep_domain = [p for p in pools if p['capabilities'][
diff --git a/manila_tempest_tests/tests/api/test_replication.py b/manila_tempest_tests/tests/api/test_replication.py
index 1a1a7c9..589f47c 100644
--- a/manila_tempest_tests/tests/api/test_replication.py
+++ b/manila_tempest_tests/tests/api/test_replication.py
@@ -25,7 +25,7 @@
 CONF = config.CONF
 _MIN_SUPPORTED_MICROVERSION = '2.11'
 SUMMARY_KEYS = ['share_id', 'id', 'replica_state', 'status']
-DETAIL_KEYS = SUMMARY_KEYS + ['availability_zone', 'host', 'updated_at',
+DETAIL_KEYS = SUMMARY_KEYS + ['availability_zone', 'updated_at',
                               'share_network_id', 'created_at']
 
 
@@ -201,7 +201,7 @@
                                                    cleanup_in_class=False)
         self.shares_v2_client.get_share_replica(share_replica2['id'])
 
-        share_replicas = self.shares_v2_client.list_share_replicas(
+        share_replicas = self.admin_client.list_share_replicas(
             share_id=self.shares[0]["id"])
         replica_host_set = {r['host'] for r in share_replicas}
 
diff --git a/manila_tempest_tests/tests/api/test_replication_negative.py b/manila_tempest_tests/tests/api/test_replication_negative.py
index c5ee021..21a5ef2 100644
--- a/manila_tempest_tests/tests/api/test_replication_negative.py
+++ b/manila_tempest_tests/tests/api/test_replication_negative.py
@@ -185,7 +185,7 @@
         hosts = [p['name'] for p in pools]
         self.create_share_replica(self.share1["id"], self.replica_zone,
                                   cleanup_in_class=False)
-        share_host = self.share1['host']
+        share_host = self.admin_client.get_share(self.share1['id'])['host']
 
         for host in hosts:
             if host != share_host:
diff --git a/manila_tempest_tests/tests/api/test_shares.py b/manila_tempest_tests/tests/api/test_shares.py
index 277f76e..a02b5f8 100644
--- a/manila_tempest_tests/tests/api/test_shares.py
+++ b/manila_tempest_tests/tests/api/test_shares.py
@@ -42,7 +42,7 @@
         share = self.create_share(self.protocol)
         detailed_elements = {'name', 'id', 'availability_zone',
                              'description', 'project_id',
-                             'host', 'created_at', 'share_proto', 'metadata',
+                             'created_at', 'share_proto', 'metadata',
                              'size', 'snapshot_id', 'share_network_id',
                              'status', 'share_type', 'volume_type', 'links',
                              'is_public'}
diff --git a/manila_tempest_tests/tests/api/test_shares_actions.py b/manila_tempest_tests/tests/api/test_shares_actions.py
index cfebdd3..0f59d7a 100644
--- a/manila_tempest_tests/tests/api/test_shares_actions.py
+++ b/manila_tempest_tests/tests/api/test_shares_actions.py
@@ -88,7 +88,7 @@
             "status", "description", "links", "availability_zone",
             "created_at", "project_id", "volume_type", "share_proto", "name",
             "snapshot_id", "id", "size", "share_network_id", "metadata",
-            "host", "snapshot_id", "is_public",
+            "snapshot_id", "is_public",
         ]
         if utils.is_microversion_lt(version, '2.9'):
             expected_keys.extend(["export_location", "export_locations"])
@@ -196,7 +196,7 @@
             "status", "description", "links", "availability_zone",
             "created_at", "project_id", "volume_type", "share_proto", "name",
             "snapshot_id", "id", "size", "share_network_id", "metadata",
-            "host", "snapshot_id", "is_public", "share_type",
+            "snapshot_id", "is_public", "share_type",
         ]
         if utils.is_microversion_lt(version, '2.9'):
             keys.extend(["export_location", "export_locations"])
@@ -284,19 +284,6 @@
             self.assertFalse(self.shares[1]['id'] in [s['id'] for s in shares])
 
     @tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
-    def test_list_shares_with_detail_filter_by_host(self):
-        base_share = self.shares_client.get_share(self.shares[0]['id'])
-        filters = {'host': base_share['host']}
-
-        # list shares
-        shares = self.shares_client.list_shares_with_detail(params=filters)
-
-        # verify response
-        self.assertGreater(len(shares), 0)
-        for share in shares:
-            self.assertEqual(filters['host'], share['host'])
-
-    @tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
     @testtools.skipIf(
         not CONF.share.multitenancy_enabled, "Only for multitenancy.")
     def test_list_shares_with_detail_filter_by_share_network_id(self):
@@ -407,7 +394,7 @@
 
         keys = [
             "status", "description", "links", "availability_zone",
-            "created_at", "export_location", "share_proto", "host",
+            "created_at", "export_location", "share_proto",
             "name", "snapshot_id", "id", "size", "project_id", "is_public",
         ]
         [self.assertIn(key, sh.keys()) for sh in shares for key in keys]
diff --git a/manila_tempest_tests/tests/api/test_shares_negative.py b/manila_tempest_tests/tests/api/test_shares_negative.py
index 42204e1..3229f2f 100644
--- a/manila_tempest_tests/tests/api/test_shares_negative.py
+++ b/manila_tempest_tests/tests/api/test_shares_negative.py
@@ -194,6 +194,12 @@
                           'fake-type')
 
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
+    def test_list_by_user_with_host_filter(self):
+        self.assertRaises(lib_exc.Forbidden,
+                          self.shares_v2_client.list_shares,
+                          params={'host': 'fake_host'})
+
+    @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
     def test_list_by_share_server_by_user(self):
         self.assertRaises(lib_exc.Forbidden,
                           self.shares_client.list_shares,
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 cd77294..835e325 100644
--- a/manila_tempest_tests/tests/scenario/test_share_basic_ops.py
+++ b/manila_tempest_tests/tests/scenario/test_share_basic_ops.py
@@ -312,7 +312,7 @@
         instance = self.boot_instance(wait_until="BUILD")
         self.create_share()
         instance = self.wait_for_active_instance(instance["id"])
-        self.share = self.shares_client.get_share(self.share['id'])
+        self.share = self.shares_admin_v2_client.get_share(self.share['id'])
 
         default_type = self.shares_v2_client.list_share_types(
             default=True)['share_type']