From patchwork Sat May 22 08:18:11 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 53257 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 50251B7D1B for ; Sat, 22 May 2010 18:39:14 +1000 (EST) Received: from localhost ([127.0.0.1]:57332 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OFkEh-0005Vr-3t for incoming@patchwork.ozlabs.org; Sat, 22 May 2010 04:39:11 -0400 Received: from [140.186.70.92] (port=58489 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OFjuo-0005Op-Lv for qemu-devel@nongnu.org; Sat, 22 May 2010 04:18:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OFjuY-0000J6-52 for qemu-devel@nongnu.org; Sat, 22 May 2010 04:18:38 -0400 Received: from fmmailgate03.web.de ([217.72.192.234]:49237) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OFjuX-0000IB-7C for qemu-devel@nongnu.org; Sat, 22 May 2010 04:18:22 -0400 Received: from smtp04.web.de ( [172.20.0.225]) by fmmailgate03.web.de (Postfix) with ESMTP id AD1061517D011; Sat, 22 May 2010 10:18:20 +0200 (CEST) Received: from [88.65.39.229] (helo=localhost.localdomain) by smtp04.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.110 #4) id 1OFjuR-00046n-02; Sat, 22 May 2010 10:18:15 +0200 From: Jan Kiszka To: qemu-devel@nongnu.org, Anthony Liguori Date: Sat, 22 May 2010 10:18:11 +0200 Message-Id: X-Mailer: git-send-email 1.6.0.2 In-Reply-To: References: In-Reply-To: References: X-Sender: jan.kiszka@web.de X-Provags-ID: V01U2FsdGVkX187JeVXOdQyY7r2M6gfLExVn+UrHejoVWLJq076 5zwU+iiEZbVgvoGiambs88eNG6hfXmVvIUp4P6GfRf9SRyGMi+ AhqRHKatM= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 Cc: Jan Kiszka , Avi Kivity , Juan Quintela , Markus Armbruster , Luiz Capitulino Subject: [Qemu-devel] [PATCH v2 14/15] QMP: Fix python helper /wrt long return strings X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Jan Kiszka Remove the arbitrary limitation of 1024 characters per return string and read complete lines instead. Required for device_show. Signed-off-by: Jan Kiszka --- QMP/qmp.py | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/QMP/qmp.py b/QMP/qmp.py index d9da603..4062f84 100644 --- a/QMP/qmp.py +++ b/QMP/qmp.py @@ -63,10 +63,14 @@ class QEMUMonitorProtocol: def __json_read(self): try: - return json.loads(self.sock.recv(1024)) + while True: + line = json.loads(self.sockfile.readline()) + if not 'event' in line: + return line except ValueError: return def __init__(self, filename): self.filename = filename self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) + self.sockfile = self.sock.makefile()