From nobody Tue Feb 10 09:28:26 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 ARC-Seal: i=1; a=rsa-sha256; t=1603816696; cv=none; d=zohomail.com; s=zohoarc; b=bgcoBzPm12GTzjYgCgituBmhq2zRSwMTbJOi8PnxsNkUH64f14BCBqnLK9t1JwBdtmAC/u9a8yv4qRklui3E05pxFvDGOi0bHz1fQToa8lpvXasThxI7u5HTLwgvTcav/OpNWjvFm371W+ERT2sgZkShqHE4stZ+MaGl4jIwAxk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603816696; h=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=w2hiL4fNVwsA3mX/slOpc8uDRW81njGur5DYtZtdL44=; b=LiABYaRAh2iGMQ2Dzaa59rytenouKph4IRD3kykdUmbIuwvl9qwJh5vAfsreGtSkfl8VAIVW7pf9Uw79spf7UepYKdfozl6OA3JRGNbCC9t2irn1j44PZVAE+B0nJZ2NzYqLJt1nQUuOWGgE2DWQuz+MQGJaILUNPzr6WlfxZSY= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1603816696102725.5233765102535; Tue, 27 Oct 2020 09:38:16 -0700 (PDT) Received: from localhost ([::1]:54318 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXRzD-0006S1-As for importer@patchew.org; Tue, 27 Oct 2020 12:38:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50552) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXRrr-0006wc-Rr; Tue, 27 Oct 2020 12:30:41 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:50107) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXRrg-0001ZX-HR; Tue, 27 Oct 2020 12:30:32 -0400 Received: from localhost.localdomain ([82.252.139.38]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1M1qfu-1kVEw93cdM-002J5r; Tue, 27 Oct 2020 17:30:22 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 6/8] scripts/qmp: delete 'qmp' script Date: Tue, 27 Oct 2020 17:30:12 +0100 Message-Id: <20201027163014.247336-7-laurent@vivier.eu> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201027163014.247336-1-laurent@vivier.eu> References: <20201027163014.247336-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:8iVYIAo6CNjm8HetN2bxTGU1xtvkDVd73KOxTv+ipEqWtnovhTS BcMexsCCgTB2ifYi7FwbLDLEz49uGrOmg65aqheQQuRrVpHSgZnrJkSvFsKJKYx81b3cHOs lLBHZNo44BX+yJI6qoLa1GqtIyX9IfCoqNCZS+yzk4KU/Qpkyt/wCqTH+4eEBlnpLrBItQz KL1TLpEnGUOmTjYlBBqVg== X-UI-Out-Filterresults: notjunk:1;V03:K0:J/dDARgCVsk=:21gqiUrwYfttXwXUaAgebF nDzsjsKmYT085tsrJjpyTh3rXFsTShTnbZsyE1tQpmzeD2hVnOkXnWDfjaKFp/QlhXMsa/vr9 MlcbPf8JDVHq1dTcfQVasPlVvt3K7JtfX2x06mPJxB6/MHKZY4wgVMJOlNdxnTTFw7hT7K6Pd ApTjhH3t97mH/fO2wwyiNW3/GGK2lszDpe54BK3WQwfEFcy3mXNYmL0QwG6Uo31UXzBCoSBIa C1NUFbN+93hTmaRhJVU2hoPp7/28tVbD57xUgqhgmAAilq8AcaVEzUMlW8/QMJz6xXjgItjmb 0RoNdOYP5E0ZlqsyH6MyHoQK2qnr76oGqbPw4OWfIvIwPOD7GcaWj4y9+VwkjwwP7I2cI4pyu AqbNy3hLCsChF4lwd95vhHsun3Z0FAYpeuJmBulyhlKQ2N6G/bU4k3RS4LHF7V9lzuNp9yEWJ lpdwZ8v3rg== 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: none client-ip=217.72.192.73; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/27 12:30:26 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=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: Thomas Huth , qemu-trivial@nongnu.org, Michael Tokarev , Laurent Vivier , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: John Snow This script has not seen a patch that was specifically for this script since it was moved to this location in 2013, and I doubt it is used. It uses "man qmp" for its help message, which does not exist. It also presumes there is a manual page for qmp-XXX, for each defined qmp command XXX. I don't think that's true. The format it expects arguments in is something like: block-dirty-bitmap-add --node=3Dfoo --name=3Dbar and has no capacity to support nested JSON arguments, either. Most developers use either qmp-shell or socat (or pasting JSON directly into qmp stdio), so this duplication and additional alternate syntax is not helpful. Remove it. Leave a breadcrumb script just in case, to be removed next release cycle. Signed-off-by: John Snow Reviewed-by: Eric Blake Reviewed-by: Thomas Huth Message-Id: <20201019210430.1063390-1-jsnow@redhat.com> Signed-off-by: Laurent Vivier --- scripts/qmp/qmp | 131 +++--------------------------------------------- 1 file changed, 7 insertions(+), 124 deletions(-) diff --git a/scripts/qmp/qmp b/scripts/qmp/qmp index 8e52e4a54dee..0f12307c8767 100755 --- a/scripts/qmp/qmp +++ b/scripts/qmp/qmp @@ -1,128 +1,11 @@ #!/usr/bin/env python3 -# -# QMP command line tool -# -# Copyright IBM, Corp. 2011 -# -# Authors: -# Anthony Liguori -# -# This work is licensed under the terms of the GNU GPLv2 or later. -# See the COPYING file in the top-level directory. =20 -import sys, os +import sys =20 -sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'pytho= n')) -from qemu.qmp import QEMUMonitorProtocol +print('''This unmaintained and undocumented script was removed in preferen= ce +for qmp-shell. The assumption is that most users are using either +qmp-shell, socat, or pasting/piping JSON into stdio. The duplication of +facilities here is unwanted, and the divergence of syntax harmful.''', + file=3Dsys.stderr) =20 -def print_response(rsp, prefix=3D[]): - if type(rsp) =3D=3D list: - i =3D 0 - for item in rsp: - if prefix =3D=3D []: - prefix =3D ['item'] - print_response(item, prefix[:-1] + ['%s[%d]' % (prefix[-1], i)= ]) - i +=3D 1 - elif type(rsp) =3D=3D dict: - for key in rsp.keys(): - print_response(rsp[key], prefix + [key]) - else: - if len(prefix): - print('%s: %s' % ('.'.join(prefix), rsp)) - else: - print('%s' % (rsp)) - -def main(args): - path =3D None - - # Use QMP_PATH if it's set - if 'QMP_PATH' in os.environ: - path =3D os.environ['QMP_PATH'] - - while len(args): - arg =3D args[0] - - if arg.startswith('--'): - arg =3D arg[2:] - if arg.find('=3D') =3D=3D -1: - value =3D True - else: - arg, value =3D arg.split('=3D', 1) - - if arg in ['path']: - if type(value) =3D=3D str: - path =3D value - elif arg in ['help']: - os.execlp('man', 'man', 'qmp') - else: - print('Unknown argument "%s"' % arg) - - args =3D args[1:] - else: - break - - if not path: - print("QMP path isn't set, use --path=3Dqmp-monitor-address or set= QMP_PATH") - return 1 - - if len(args): - command, args =3D args[0], args[1:] - else: - print('No command found') - print('Usage: "qmp [--path=3Dqmp-monitor-address] qmp-cmd argument= s"') - return 1 - - if command in ['help']: - os.execlp('man', 'man', 'qmp') - - srv =3D QEMUMonitorProtocol(path) - srv.connect() - - def do_command(srv, cmd, **kwds): - rsp =3D srv.cmd(cmd, kwds) - if 'error' in rsp: - raise Exception(rsp['error']['desc']) - return rsp['return'] - - commands =3D map(lambda x: x['name'], do_command(srv, 'query-commands'= )) - - srv.close() - - if command not in commands: - fullcmd =3D 'qmp-%s' % command - try: - os.environ['QMP_PATH'] =3D path - os.execvp(fullcmd, [fullcmd] + args) - except OSError as exc: - if exc.errno =3D=3D 2: - print('Command "%s" not found.' % (fullcmd)) - return 1 - raise - return 0 - - srv =3D QEMUMonitorProtocol(path) - srv.connect() - - arguments =3D {} - for arg in args: - if not arg.startswith('--'): - print('Unknown argument "%s"' % arg) - return 1 - - arg =3D arg[2:] - if arg.find('=3D') =3D=3D -1: - value =3D True - else: - arg, value =3D arg.split('=3D', 1) - - if arg in ['help']: - os.execlp('man', 'man', 'qmp-%s' % command) - return 1 - - arguments[arg] =3D value - - rsp =3D do_command(srv, command, **arguments) - print_response(rsp) - -if __name__ =3D=3D '__main__': - sys.exit(main(sys.argv[1:])) +sys.exit(1) --=20 2.26.2