Updated wait_for_volume_status exception message

Change-Id: Ief7bdc305076742484932fd2f7441313757eb277
This commit is contained in:
Jose Idar
2014-02-04 14:14:18 -06:00
parent 9e2c8e5d3a
commit 40bb10377c

View File

@@ -108,6 +108,7 @@ class VolumesAPI_Behaviors(BaseBehavior):
pass pass
endtime = time() + timeout endtime = time() + timeout
current_status = None
while time() < endtime: while time() < endtime:
current_status = self.get_volume_status( current_status = self.get_volume_status(
volume_id) volume_id)
@@ -128,23 +129,25 @@ class VolumesAPI_Behaviors(BaseBehavior):
else: else:
if transient: if transient:
self._log.debug( self._log.debug(
"Netiher the transient status {0} nor the next status " "Neither the transient status {0} nor the next status "
"{1} where found, continuing to next status " "{1} where found, continuing to next status "
"search".format(expected_status, next_status)) "search".format(expected_status, next_status))
continue continue
else: else:
msg = ( msg = (
"Volume did not progress to the {0} status in the " "Volume did not progress to the {expected_status} "
"alloted time of {1} seconds".format( "status in the alloted time of {timeout} seconds. Last"
expected_status, timeout)) " observed status was {last_observed}".format(
expected_status=expected_status,
timeout=timeout, last_observed=current_status))
self._log.error(msg) self._log.error(msg)
raise VolumesAPIBehaviorException(msg) raise VolumesAPIBehaviorException(msg)
@behavior(VolumesClient) @behavior(VolumesClient)
def wait_for_volume_status( def wait_for_volume_status(
self, volume_id, expected_status, timeout, poll_rate=None): self, volume_id, expected_status, timeout, poll_rate=None):
""" Waits for a specific status and returns None when that status is """ Waits for a specific status. Raises VolumesAPIBehaviorException
observed. if status is not observed within timeout seconds.
Note: Unreliable for transient statuses like 'deleting'. Note: Unreliable for transient statuses like 'deleting'.
""" """