Merge "Fixed Share server migration test related to CIFS."
diff --git a/manila_tempest_tests/common/waiters.py b/manila_tempest_tests/common/waiters.py
index 8a97c8e..11a02d3 100644
--- a/manila_tempest_tests/common/waiters.py
+++ b/manila_tempest_tests/common/waiters.py
@@ -45,7 +45,8 @@
                              resource_name='share', rule_id=None,
                              status_attr='status',
                              raise_rule_in_error_state=True,
-                             version=LATEST_MICROVERSION):
+                             version=LATEST_MICROVERSION,
+                             timeout=None):
     """Waits for a resource to reach a given status."""
 
     get_resource_action = {
@@ -86,6 +87,9 @@
     start = int(time.time())
 
     exp_status = status if isinstance(status, list) else [status]
+    resource_status_check_time_out = client.build_timeout
+    if timeout is not None:
+        resource_status_check_time_out = timeout
     while resource_status not in exp_status:
         time.sleep(client.build_interval)
         body = resource_action(*method_args, **method_kwargs)[rn]
@@ -102,11 +106,11 @@
             raise_method = _get_name_of_raise_method(resource_name)
             resource_exception = getattr(share_exceptions, raise_method)
             raise resource_exception(resource_id=resource_id)
-        if int(time.time()) - start >= client.build_timeout:
+        if int(time.time()) - start >= resource_status_check_time_out:
             message = ('%s %s failed to reach %s status (current %s) '
                        'within the required time (%s s).' %
                        (resource_name.replace('_', ' '), resource_id, status,
-                        resource_status, client.build_timeout))
+                        resource_status, resource_status_check_time_out))
             raise exceptions.TimeoutException(message)
 
 
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 2535745..d3ec3f1 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
@@ -282,10 +282,11 @@
             src_server_id, dest_host, preserve_snapshots=preserve_snapshots)
 
         expected_state = constants.TASK_STATE_MIGRATION_DRIVER_PHASE1_DONE
+        timeout = CONF.share.share_server_migration_timeout
         waiters.wait_for_resource_status(
             self.shares_v2_client, src_server_id,
             expected_state, resource_name='share_server',
-            status_attr='task_state'
+            status_attr='task_state', timeout=timeout
         )
 
         # Get for the destination share server.
@@ -352,10 +353,11 @@
             preserve_snapshots=preserve_snapshots)
 
         expected_state = constants.TASK_STATE_MIGRATION_DRIVER_PHASE1_DONE
+        timeout = CONF.share.share_server_migration_timeout
         waiters.wait_for_resource_status(
             self.shares_v2_client, src_server_id,
             expected_state, resource_name='share_server',
-            status_attr='task_state'
+            status_attr='task_state', timeout=timeout
         )
         # Get for the destination share server.
         dest_server_id = self._get_share_server_destination_for_migration(