From c5e397df9e247bff2398400864cde94d1b40317c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Thu, 4 May 2017 16:54:29 +0400 Subject: [PATCH] qmp-shell: add -N option to skip negotiate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit qemu-ga doesn't have negotiate phase. Signed-off-by: Marc-André Lureau Message-Id: <20170504125432.21653-2-marcandre.lureau@redhat.com> Reviewed-by: Eric Blake Signed-off-by: Markus Armbruster --- scripts/qmp/qmp-shell | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/qmp/qmp-shell b/scripts/qmp/qmp-shell index 6ece6e7c81..b4d2dbd292 100755 --- a/scripts/qmp/qmp-shell +++ b/scripts/qmp/qmp-shell @@ -277,8 +277,8 @@ class QMPShell(qmp.QEMUMonitorProtocol): self._print(resp) return True - def connect(self): - self._greeting = qmp.QEMUMonitorProtocol.connect(self) + def connect(self, negotiate): + self._greeting = qmp.QEMUMonitorProtocol.connect(self, negotiate) self.__completer_setup() def show_banner(self, msg='Welcome to the QMP low-level shell!'): @@ -390,7 +390,7 @@ def die(msg): def fail_cmdline(option=None): if option: sys.stderr.write('ERROR: bad command-line option \'%s\'\n' % option) - sys.stderr.write('qemu-shell [ -v ] [ -p ] [ -H ] < UNIX socket path> | < TCP address:port >\n') + sys.stderr.write('qemu-shell [ -v ] [ -p ] [ -H ] [ -N ] < UNIX socket path> | < TCP address:port >\n') sys.exit(1) def main(): @@ -399,6 +399,7 @@ def main(): hmp = False pretty = False verbose = False + negotiate = True try: for arg in sys.argv[1:]: @@ -408,6 +409,8 @@ def main(): hmp = True elif arg == "-p": pretty = True + elif arg == "-N": + negotiate = False elif arg == "-v": verbose = True else: @@ -425,7 +428,7 @@ def main(): die('bad port number in command-line') try: - qemu.connect() + qemu.connect(negotiate) except qmp.QMPConnectError: die('Didn\'t get QMP greeting message') except qmp.QMPCapabilitiesError: