Narrow race in wait_for_server_status().
There's a narrow race condition in ServersClient.wait_for_server_status()
with a false negative reported when the expected state transition occurs
during the last build_interval period of the acceptable time window.
More likely to be seen if the build_time is shortened down from the
default 600s.
Change-Id: Ibe45df5d6689aa7a8a196b09744d7fcb4f183364
diff --git a/tempest/services/nova/json/servers_client.py b/tempest/services/nova/json/servers_client.py
index 605bd46..e0a26de 100644
--- a/tempest/services/nova/json/servers_client.py
+++ b/tempest/services/nova/json/servers_client.py
@@ -146,10 +146,13 @@
if server_status == 'ERROR':
raise exceptions.BuildErrorException(server_id=server_id)
- if int(time.time()) - start >= self.build_timeout:
+ timed_out = int(time.time()) - start >= self.build_timeout
+
+ if server_status != status and timed_out:
message = 'Server %s failed to reach %s status within the \
required time (%s s).' % (server_id, status,
self.build_timeout)
+ message += ' Current status: %s.' % server_status
raise exceptions.TimeoutException(message)
def list_addresses(self, server_id):