qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Capitulino <lcapitulino@redhat.com>
To: aliguori@us.ibm.com
Cc: Ryota Ozaki <ozaki.ryota@gmail.com>, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL 01/15] Make negotiation optional in QEMUMonitorProtocol
Date: Thu, 27 Sep 2012 10:28:15 -0300	[thread overview]
Message-ID: <1348752509-1142-2-git-send-email-lcapitulino@redhat.com> (raw)
In-Reply-To: <1348752509-1142-1-git-send-email-lcapitulino@redhat.com>

From: Ryota Ozaki <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>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.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.315.g682ce8b

  reply	other threads:[~2012-09-27 13:28 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-27 13:28 [Qemu-devel] [PULL 00/15]: QMP queue Luiz Capitulino
2012-09-27 13:28 ` Luiz Capitulino [this message]
2012-09-27 13:28 ` [Qemu-devel] [PULL 02/15] Support settimeout in QEMUMonitorProtocol Luiz Capitulino
2012-09-27 13:28 ` [Qemu-devel] [PULL 03/15] Add qemu-ga-client script Luiz Capitulino
2012-09-27 13:28 ` [Qemu-devel] [PULL 04/15] qapi: do not protect enum values from namespace pollution Luiz Capitulino
2012-09-27 13:28 ` [Qemu-devel] [PULL 05/15] qapi: add "unix" to the set of reserved words Luiz Capitulino
2012-09-27 13:28 ` [Qemu-devel] [PULL 06/15] pci-assign: use monitor_handle_fd_param Luiz Capitulino
2012-09-27 13:28 ` [Qemu-devel] [PULL 07/15] monitor: add Error * argument to monitor_get_fd Luiz Capitulino
2012-09-27 13:28 ` [Qemu-devel] [PULL 08/15] qapi: convert add_client Luiz Capitulino
2012-09-27 13:28 ` [Qemu-devel] [PULL 09/15] qmp: dump-guest-memory: improve schema doc (again) Luiz Capitulino
2012-09-27 13:28 ` [Qemu-devel] [PULL 10/15] qmp: dump-guest-memory: don't spin if non-blocking fd would block Luiz Capitulino
2012-09-27 13:28 ` [Qemu-devel] [PULL 11/15] hmp: dump-guest-memory: hardcode protocol argument to "file:" Luiz Capitulino
2012-09-28 17:17   ` Eric Blake
2012-09-27 13:28 ` [Qemu-devel] [PULL 12/15] input: qmp_send_key(): simplify Luiz Capitulino
2012-09-27 13:28 ` [Qemu-devel] [PULL 13/15] qmp: qmp_send_key(): accept key codes in hex Luiz Capitulino
2012-09-28 10:36   ` Amos Kong
2012-09-28 13:01     ` Eric Blake
2012-09-28 13:30       ` Luiz Capitulino
2012-09-28 13:24     ` Luiz Capitulino
2012-09-28 13:30       ` Amos Kong
2012-09-27 13:28 ` [Qemu-devel] [PULL 14/15] input: index_from_key(): drop unused code Luiz Capitulino
2012-09-27 13:28 ` [Qemu-devel] [PULL 15/15] block: live snapshot documentation tweaks Luiz Capitulino
2012-10-05  2:12 ` [Qemu-devel] [PULL 00/15]: QMP queue Anthony Liguori

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=1348752509-1142-2-git-send-email-lcapitulino@redhat.com \
    --to=lcapitulino@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=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).