Merge "Fix Share Migration tempest tests"
diff --git a/manila_tempest_tests/config.py b/manila_tempest_tests/config.py
index daed82e..c794168 100644
--- a/manila_tempest_tests/config.py
+++ b/manila_tempest_tests/config.py
@@ -144,6 +144,9 @@
                 help="Defines whether to run consistency group tests or not. "
                      "Disable this feature if used driver doesn't support "
                      "it."),
+    cfg.BoolOpt("run_migration_tests",
+                default=False,
+                help="Enable or disable migration tests."),
     cfg.StrOpt("image_with_share_tools",
                default="manila-service-image",
                help="Image name for vm booting with nfs/smb clients tool."),
@@ -160,7 +163,4 @@
                default=1200,
                help="Time to wait for share migration before "
                     "timing out (seconds)."),
-    cfg.BoolOpt("migration_enabled",
-                default=True,
-                help="Enable or disable migration tests."),
 ]
diff --git a/manila_tempest_tests/tests/api/admin/test_migration.py b/manila_tempest_tests/tests/api/admin/test_migration.py
index 75b4ba7..517f43d 100644
--- a/manila_tempest_tests/tests/api/admin/test_migration.py
+++ b/manila_tempest_tests/tests/api/admin/test_migration.py
@@ -21,7 +21,7 @@
 CONF = config.CONF
 
 
-class MigrationTest(base.BaseSharesAdminTest):
+class MigrationNFSTest(base.BaseSharesAdminTest):
     """Tests Share Migration.
 
     Tests migration in multi-backend environment.
@@ -31,23 +31,23 @@
 
     @classmethod
     def resource_setup(cls):
-        super(MigrationTest, cls).resource_setup()
+        super(MigrationNFSTest, cls).resource_setup()
         if cls.protocol not in CONF.share.enable_protocols:
             message = "%s tests are disabled" % cls.protocol
             raise cls.skipException(message)
+        if not CONF.share.run_migration_tests:
+            raise cls.skipException("Migration tests disabled. Skipping.")
 
-    @test.attr(type=["gate", "smoke", ])
+    @test.attr(type=["gate", ])
     def test_migration_empty_v2_5(self):
 
-        if not CONF.share.migration_enabled:
-            raise self.skipException("Migration tests disabled. Skipping.")
-
         pools = self.shares_client.list_pools()['pools']
 
         if len(pools) < 2:
-            raise self.skipException("At least two different running "
-                                     "manila-share services are needed to "
-                                     "run migration tests. Skipping.")
+            raise self.skipException("At least two different pool entries "
+                                     "are needed to run migration tests. "
+                                     "Skipping.")
+
         share = self.create_share(self.protocol)
         share = self.shares_client.get_share(share['id'])
 
@@ -55,6 +55,7 @@
                          None)
 
         self.assertIsNotNone(dest_pool)
+        self.assertIsNotNone(dest_pool.get('name'))
 
         dest_pool = dest_pool['name']
 
diff --git a/manila_tempest_tests/tests/scenario/manager_share.py b/manila_tempest_tests/tests/scenario/manager_share.py
index 00a2209..3c40590 100644
--- a/manila_tempest_tests/tests/scenario/manager_share.py
+++ b/manila_tempest_tests/tests/scenario/manager_share.py
@@ -39,6 +39,8 @@
         # Manila clients
         cls.shares_client = clients_share.Manager().shares_client
         cls.shares_admin_client = clients_share.AdminManager().shares_client
+        cls.shares_admin_v2_client = (
+            clients_share.AdminManager().shares_v2_client)
 
     def _create_share(self, share_protocol=None, size=1, name=None,
                       snapshot_id=None, description=None, metadata=None,
@@ -184,7 +186,7 @@
         return linux_client
 
     def _migrate_share(self, share_id, dest_host, client=None):
-        client = client or self.shares_client
+        client = client or self.shares_admin_v2_client
         client.migrate_share(share_id, dest_host)
         share = client.wait_for_migration_completed(share_id, dest_host)
         return share
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 be07639..a6eba09 100644
--- a/manila_tempest_tests/tests/scenario/test_share_basic_ops.py
+++ b/manila_tempest_tests/tests/scenario/test_share_basic_ops.py
@@ -118,7 +118,7 @@
 
     def migrate_share(self, share_id, dest_host):
         share = self._migrate_share(share_id, dest_host,
-                                    self.shares_admin_client)
+                                    self.shares_admin_v2_client)
         return share
 
     def create_share_network(self):
@@ -200,15 +200,15 @@
             raise self.skipException("Test for CIFS protocol not supported "
                                      "at this moment. Skipping.")
 
-        if not CONF.share.migration_enabled:
+        if not CONF.share.run_migration_tests:
             raise self.skipException("Migration tests disabled. Skipping.")
 
         pools = self.shares_admin_client.list_pools()['pools']
 
         if len(pools) < 2:
-            raise self.skipException("At least two different running "
-                                     "manila-share services are needed to "
-                                     "run migration tests. Skipping.")
+            raise self.skipException("At least two different pool entries "
+                                     "are needed to run migration tests. "
+                                     "Skipping.")
 
         self.security_group = self._create_security_group()
         self.create_share_network()
@@ -219,6 +219,7 @@
                          None)
 
         self.assertIsNotNone(dest_pool)
+        self.assertIsNotNone(dest_pool.get('name'))
 
         dest_pool = dest_pool['name']