From patchwork Fri Jul 22 08:00:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Shah X-Patchwork-Id: 651562 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rwjsG4DCTz9srZ for ; Fri, 22 Jul 2016 18:06:26 +1000 (AEST) Received: from localhost ([::1]:45716 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQVTU-0004jb-9N for incoming@patchwork.ozlabs.org; Fri, 22 Jul 2016 04:06:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52903) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQVOi-0000aS-2h for qemu-devel@nongnu.org; Fri, 22 Jul 2016 04:01:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bQVOd-0006iy-4T for qemu-devel@nongnu.org; Fri, 22 Jul 2016 04:01:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40761) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQVOc-0006ip-WB for qemu-devel@nongnu.org; Fri, 22 Jul 2016 04:01:23 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7F956C05AA56; Fri, 22 Jul 2016 08:01:22 +0000 (UTC) Received: from localhost (ovpn-116-64.phx2.redhat.com [10.3.116.64]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6M81Kkf027380; Fri, 22 Jul 2016 04:01:21 -0400 From: Amit Shah To: qemu list Date: Fri, 22 Jul 2016 13:30:51 +0530 Message-Id: <238064621fcf5fabedc36d2acdfffa72c723a748.1469174334.git.amit.shah@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 22 Jul 2016 08:01:22 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 5/7] scripts: set timeout when waiting for qemu monitor connection X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Amit Shah , Peter Maydell , "Dr. David Alan Gilbert" , Juan Quintela Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: "Daniel P. Berrange" 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 Message-Id: <1469020993-29426-5-git-send-email-berrange@redhat.com> Signed-off-by: Amit Shah --- scripts/qmp/qmp.py | 1 + 1 file changed, 1 insertion(+) 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()