From: Ryota Ozaki <ozaki.ryota@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 1/3] Make negotiation optional in QEMUMonitorProtocol
Date: Fri, 14 Sep 2012 21:44:20 +0900 [thread overview]
Message-ID: <1347626662-3701-2-git-send-email-ozaki.ryota@gmail.com> (raw)
In-Reply-To: <1347626662-3701-1-git-send-email-ozaki.ryota@gmail.com>
This is a preparation for qemu-ga-client which uses
QEMUMonitorProtocol class. The class tries to
negotiate capabilities on connect, however, qemu-ga
doesn't suppose it and fails.
This change makes the negotiation optional, though
it's still performed by default for compatibility.
Signed-off-by: Ryota Ozaki <ozaki.ryota@gmail.com>
---
QMP/qmp.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/QMP/qmp.py b/QMP/qmp.py
index 36ecc1d..5a573e1 100644
--- a/QMP/qmp.py
+++ b/QMP/qmp.py
@@ -49,7 +49,6 @@ class QEMUMonitorProtocol:
return socket.socket(family, socket.SOCK_STREAM)
def __negotiate_capabilities(self):
- self.__sockfile = self.__sock.makefile()
greeting = self.__json_read()
if greeting is None or not greeting.has_key('QMP'):
raise QMPConnectError
@@ -73,7 +72,7 @@ class QEMUMonitorProtocol:
error = socket.error
- def connect(self):
+ def connect(self, negotiate=True):
"""
Connect to the QMP Monitor and perform capabilities negotiation.
@@ -83,7 +82,9 @@ class QEMUMonitorProtocol:
@raise QMPCapabilitiesError if fails to negotiate capabilities
"""
self.__sock.connect(self.__address)
- return self.__negotiate_capabilities()
+ self.__sockfile = self.__sock.makefile()
+ if negotiate:
+ return self.__negotiate_capabilities()
def accept(self):
"""
--
1.7.12
next prev parent reply other threads:[~2012-09-14 12:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-14 12:44 [Qemu-devel] [PATCH 0/3] Intruduce qemu-ga-client Ryota Ozaki
2012-09-14 12:44 ` Ryota Ozaki [this message]
2012-09-14 12:44 ` [Qemu-devel] [PATCH 2/3] Support settimeout in QEMUMonitorProtocol Ryota Ozaki
2012-09-14 12:44 ` [Qemu-devel] [PATCH 3/3] Add qemu-ga-client script Ryota Ozaki
2012-09-19 20:20 ` [Qemu-devel] [PATCH 0/3] Intruduce qemu-ga-client Luiz Capitulino
2012-09-20 4:40 ` Michael Tokarev
2012-09-20 11:45 ` Ryota Ozaki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1347626662-3701-2-git-send-email-ozaki.ryota@gmail.com \
--to=ozaki.ryota@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).