From nobody Mon Feb 9 11:06:07 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594765975; cv=none; d=zohomail.com; s=zohoarc; b=Sky/mm4RJP3lWWwA6LNq8xNJtoYoGewbCu8e+R734tLbKwekMMfZhkFjFJFtWCCKzYwTskkuwaoexp9nxTCJDgO+LzfZDM2YbR4NDGGV8gMntAqnMCX4eLwmAEfwQV4Gb27Qs3hfZbK6UVKLYewIk7+6Nmd9AUxn2ZCeHpwFbBU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594765975; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Akupi2/psErTNl648GD773WL1cQbHEfDPZG4YPkFXLs=; b=XMTjyo9kzQCkJoNIcmkqMFkv/l4JVKWPLs8Mf2ivHyqs5s4g+yQhgDYsRT/Xf1cNmORirsrriIrZ11xxIDTiMaW1NWXTlb7sNL95HMKobdlWx+L4kgfBLQ00LNgxYuJsbL9ifpuXDdBGrR+1eEkoVJyGWZnb2DkVbeEtioVw1/Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1594765975764995.4456995833317; Tue, 14 Jul 2020 15:32:55 -0700 (PDT) Received: from localhost ([::1]:35328 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jvTTq-0000dF-Id for importer@patchew.org; Tue, 14 Jul 2020 18:32:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50648) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jvTKV-0002OW-AG for qemu-devel@nongnu.org; Tue, 14 Jul 2020 18:23:15 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:50702 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jvTKQ-0004xx-Cm for qemu-devel@nongnu.org; Tue, 14 Jul 2020 18:23:15 -0400 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-462-yyqF41_9PEWTeYW7Tzf-kQ-1; Tue, 14 Jul 2020 18:23:08 -0400 Received: by mail-wm1-f71.google.com with SMTP id s134so94655wme.6 for ; Tue, 14 Jul 2020 15:23:08 -0700 (PDT) Received: from localhost.localdomain (138.red-83-57-170.dynamicip.rima-tde.net. [83.57.170.138]) by smtp.gmail.com with ESMTPSA id w17sm200963wra.42.2020.07.14.15.23.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2020 15:23:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594765389; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Akupi2/psErTNl648GD773WL1cQbHEfDPZG4YPkFXLs=; b=bppqArzsDqcBwpInWR6vq2doUZNlZagkRfUaIi45Qko7XQn0566YvKoL++iFhtM7mUKkhp QRWRZexkZeyvT2NaXex9XUSjo3yToK66xuB59ClXopQvHFEqR24lGIRFZVFXrbSP5bxdNG eAQ88EER4ZbBEOEKmUmYo73Z0tMs8zs= X-MC-Unique: yyqF41_9PEWTeYW7Tzf-kQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Akupi2/psErTNl648GD773WL1cQbHEfDPZG4YPkFXLs=; b=F9F9OuyOThagS1Ga6X/yOwNDqX6XOOQi9J0gSORy1Xys4wDdMNE9INd5eWl992AZUL GrPfEFYvHltZG24T7bRRiILEJNhRbmMYl9gBkIJ1fjb2yKpLOSUjRZSferNvnOuh3R4D GtGxM7UmTmOSgFBMfAC6iCY5NWSw+fHkSCvLYNj4bWsmzwm58re6Xew4xFg452gNHkVR 7+qUr7T1MXa36pRRVxmGVW7wUQRIl0B94b3gLtDWaneASr+EeL9FrpiGIdujD2VGvgbb ad8wZ6xfT0KfyUt89N17KJ65Trj2Uy99glg5a4NHiiP+HZS02HrsPJFnJq7dOqOG3lwO wYSA== X-Gm-Message-State: AOAM531n1v94I6kCvcYlm05Cmc+sHC+Jq3516ng+ZKqSJtPubO/Jtqrp by5XbTvAfYymiWmrXgbQsBuFut9SMHcT/cZlUeD7CTg6DLr+8OswYu3dOIl+dB7BcplXsLMgn8m p0TFF88r0xgVTo7U= X-Received: by 2002:a05:600c:313:: with SMTP id q19mr5112983wmd.9.1594765385249; Tue, 14 Jul 2020 15:23:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzl1qd4y1/guXy5rG6B2MQmlkEIjFWiigjiGR1tZNete2GxbwUixFCefgmCOIC3Bxi6hpAqSA== X-Received: by 2002:a05:600c:313:: with SMTP id q19mr5112971wmd.9.1594765385077; Tue, 14 Jul 2020 15:23:05 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 19/19] python/qmp.py: add QMPProtocolError Date: Wed, 15 Jul 2020 00:21:32 +0200 Message-Id: <20200714222132.10815-20-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200714222132.10815-1-philmd@redhat.com> References: <20200714222132.10815-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=philmd@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/14 01:42:04 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Eduardo Habkost , John Snow , Ahmed Karaman , Cleber Rosa , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: John Snow In the case that we receive a reply but are unable to understand it, use this exception name to indicate that case. Signed-off-by: John Snow Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Kevin Wolf Message-Id: <20200710052220.3306-7-jsnow@redhat.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- python/qemu/qmp.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/python/qemu/qmp.py b/python/qemu/qmp.py index 1ae36050a4..7935dababb 100644 --- a/python/qemu/qmp.py +++ b/python/qemu/qmp.py @@ -62,6 +62,12 @@ class QMPTimeoutError(QMPError): """ =20 =20 +class QMPProtocolError(QMPError): + """ + QMP protocol error; unexpected response + """ + + class QMPResponseError(QMPError): """ Represents erroneous QMP monitor reply @@ -266,6 +272,10 @@ def command(self, cmd, **kwds): ret =3D self.cmd(cmd, kwds) if 'error' in ret: raise QMPResponseError(ret) + if 'return' not in ret: + raise QMPProtocolError( + "'return' key not found in QMP response '{}'".format(str(r= et)) + ) return cast(QMPReturnValue, ret['return']) =20 def pull_event(self, wait=3DFalse): --=20 2.21.3