提交 f5d3d218 编写于 作者: P Philippe Mathieu-Daudé 提交者: Fam Zheng

tests/vm: Display remaining seconds to wait for a VM to start

Signed-off-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20181013004034.6968-5-f4bug@amsat.org>
Reviewed-by: NRichard Henderson <richard.henderson@linaro.org>
Signed-off-by: NFam Zheng <famz@redhat.com>
上级 071cf5a4
......@@ -177,11 +177,14 @@ class BaseVM(object):
def wait_ssh(self, seconds=300):
starttime = datetime.datetime.now()
endtime = starttime + datetime.timedelta(seconds=seconds)
guest_up = False
while (datetime.datetime.now() - starttime).total_seconds() < seconds:
while datetime.datetime.now() < endtime:
if self.ssh("exit 0") == 0:
guest_up = True
break
seconds = (endtime - datetime.datetime.now()).total_seconds()
logging.debug("%ds before timeout", seconds)
time.sleep(1)
if not guest_up:
raise Exception("Timeout while waiting for guest ssh")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册