python/aqmp: Fix negotiation with pre-"oob" QEMU
authorJohn Snow <jsnow@redhat.com>
Tue, 1 Feb 2022 04:11:31 +0000 (23:11 -0500)
committerJohn Snow <jsnow@redhat.com>
Wed, 2 Feb 2022 19:12:22 +0000 (14:12 -0500)
QEMU versions prior to the "oob" capability *also* can't accept the
"enable" keyword argument at all. Fix the handshake process with older
QEMU versions.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Hanna Reitz <hreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-id: 20220201041134.1237016-2-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
python/qemu/aqmp/qmp_client.py

index f1a845cc822f40d7a3af5214f129829816e5a2e4..90a8737f03a997f6813ee7cbcaac2f26d2c8024c 100644 (file)
@@ -292,9 +292,9 @@ class QMPClient(AsyncProtocol[Message], Events):
         """
         self.logger.debug("Negotiating capabilities ...")
 
-        arguments: Dict[str, List[str]] = {'enable': []}
+        arguments: Dict[str, List[str]] = {}
         if self._greeting and 'oob' in self._greeting.QMP.capabilities:
-            arguments['enable'].append('oob')
+            arguments.setdefault('enable', []).append('oob')
         msg = self.make_execute_msg('qmp_capabilities', arguments=arguments)
 
         # It's not safe to use execute() here, because the reader/writers