aboutsummaryrefslogtreecommitdiff
path: root/scripts/qmp
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2016-07-20 14:23:11 +0100
committerAmit Shah <amit.shah@redhat.com>2016-07-22 13:23:28 +0530
commit238064621fcf5fabedc36d2acdfffa72c723a748 (patch)
tree1d9b8d87f26726425e7753992956d24374c32aeb /scripts/qmp
parent66613974468fb6e1609fb3eabf55981b1ee436cf (diff)
downloadqemu-238064621fcf5fabedc36d2acdfffa72c723a748.zip
qemu-238064621fcf5fabedc36d2acdfffa72c723a748.tar.gz
qemu-238064621fcf5fabedc36d2acdfffa72c723a748.tar.bz2
scripts: set timeout when waiting for qemu monitor connection
If QEMU fails to launch for some reason, the QEMUMonitorProtocol class accept() method will wait forever in a socket accept call. Set a timeout of 15 seconds so that we fail more gracefully instead of hanging the test script forever Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1469020993-29426-5-git-send-email-berrange@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
Diffstat (limited to 'scripts/qmp')
-rw-r--r--scripts/qmp/qmp.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/scripts/qmp/qmp.py b/scripts/qmp/qmp.py
index 70e927e..2d0d926 100644
--- a/scripts/qmp/qmp.py
+++ b/scripts/qmp/qmp.py
@@ -140,6 +140,7 @@ class QEMUMonitorProtocol:
@raise QMPConnectError if the greeting is not received
@raise QMPCapabilitiesError if fails to negotiate capabilities
"""
+ self.__sock.settimeout(15)
self.__sock, _ = self.__sock.accept()
self.__sockfile = self.__sock.makefile()
return self.__negotiate_capabilities()