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