From patchwork Thu May 5 14:27:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= X-Patchwork-Id: 9025021 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 032E19F372 for ; Thu, 5 May 2016 14:29:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7518C203AA for ; Thu, 5 May 2016 14:29:48 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CD11C2037C for ; Thu, 5 May 2016 14:29:47 +0000 (UTC) Received: from localhost ([::1]:53849 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ayKHg-0002Rq-00 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 05 May 2016 10:29:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57173) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ayKHN-000280-7d for qemu-devel@nongnu.org; Thu, 05 May 2016 10:29:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ayKHB-00054v-Jh for qemu-devel@nongnu.org; Thu, 05 May 2016 10:29:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34189) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ayKHB-00051W-FA for qemu-devel@nongnu.org; Thu, 05 May 2016 10:29:13 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (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 657DB7EBA8 for ; Thu, 5 May 2016 14:29:02 +0000 (UTC) Received: from catbus.gsslab.fab.redhat.com (dhcp-91.gsslab.fab.redhat.com [10.33.9.91]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u45ESue7014172; Thu, 5 May 2016 10:29:01 -0400 From: "Daniel P. Berrange" To: qemu-devel@nongnu.org Date: Thu, 5 May 2016 15:27:58 +0100 Message-Id: <1462458480-20555-5-git-send-email-berrange@redhat.com> In-Reply-To: <1462458480-20555-1-git-send-email-berrange@redhat.com> References: <1462458480-20555-1-git-send-email-berrange@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 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] [PATCH v1 4/6] 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 , "Dr. David Alan Gilbert" , Juan Quintela Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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()