* [Qemu-devel] [PATCH 1/5] QMP: QError: New QERR_UNSUPPORTED
2011-06-01 15:54 [Qemu-devel] [PULL 0/5]: Monitor queue Luiz Capitulino
@ 2011-06-01 15:54 ` Luiz Capitulino
2011-06-01 15:54 ` [Qemu-devel] [PATCH 2/5] QMP: add inject-nmi qmp command Luiz Capitulino
` (4 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: Luiz Capitulino @ 2011-06-01 15:54 UTC (permalink / raw)
To: aliguori; +Cc: Lai Jiangshan, qemu-devel, armbru
From: Lai Jiangshan <laijs@cn.fujitsu.com>
New QERR_UNSUPPORTED for unsupported commands or requests.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
qerror.c | 4 ++++
qerror.h | 3 +++
2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/qerror.c b/qerror.c
index 4855604..4f3b7ca 100644
--- a/qerror.c
+++ b/qerror.c
@@ -201,6 +201,10 @@ static const QErrorStringTable qerror_table[] = {
.desc = "An undefined error has ocurred",
},
{
+ .error_fmt = QERR_UNSUPPORTED,
+ .desc = "this feature or command is not currently supported",
+ },
+ {
.error_fmt = QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
.desc = "'%(device)' uses a %(format) feature which is not "
"supported by this qemu version: %(feature)",
diff --git a/qerror.h b/qerror.h
index df61d2c..582b5ef 100644
--- a/qerror.h
+++ b/qerror.h
@@ -165,6 +165,9 @@ QError *qobject_to_qerror(const QObject *obj);
#define QERR_UNDEFINED_ERROR \
"{ 'class': 'UndefinedError', 'data': {} }"
+#define QERR_UNSUPPORTED \
+ "{ 'class': 'Unsupported', 'data': {} }"
+
#define QERR_UNKNOWN_BLOCK_FORMAT_FEATURE \
"{ 'class': 'UnknownBlockFormatFeature', 'data': { 'device': %s, 'format': %s, 'feature': %s } }"
--
1.7.4.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH 2/5] QMP: add inject-nmi qmp command
2011-06-01 15:54 [Qemu-devel] [PULL 0/5]: Monitor queue Luiz Capitulino
2011-06-01 15:54 ` [Qemu-devel] [PATCH 1/5] QMP: QError: New QERR_UNSUPPORTED Luiz Capitulino
@ 2011-06-01 15:54 ` Luiz Capitulino
2011-06-04 8:34 ` Blue Swirl
2011-06-01 15:54 ` [Qemu-devel] [PATCH 3/5] HMP: Use QMP inject nmi implementation Luiz Capitulino
` (3 subsequent siblings)
5 siblings, 1 reply; 12+ messages in thread
From: Luiz Capitulino @ 2011-06-01 15:54 UTC (permalink / raw)
To: aliguori; +Cc: Lai Jiangshan, qemu-devel, armbru
From: Lai Jiangshan <laijs@cn.fujitsu.com>
inject-nmi command injects an NMI on all CPUs of guest.
It is only supported for x86 guest currently, it will
returns "Unsupported" error for non-x86 guest.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
monitor.c | 17 +++++++++++++++++
qmp-commands.hx | 27 +++++++++++++++++++++++++++
2 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/monitor.c b/monitor.c
index f63cce0..81d3c9b 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2555,6 +2555,23 @@ static void do_inject_nmi(Monitor *mon, const QDict *qdict)
break;
}
}
+
+static int do_inject_nmi_all(Monitor *mon, const QDict *qdict, QObject **ret_data)
+{
+ CPUState *env;
+
+ for (env = first_cpu; env != NULL; env = env->next_cpu) {
+ cpu_interrupt(env, CPU_INTERRUPT_NMI);
+ }
+
+ return 0;
+}
+#else
+static int do_inject_nmi_all(Monitor *mon, const QDict *qdict, QObject **ret_data)
+{
+ qerror_report(QERR_UNSUPPORTED);
+ return -1;
+}
#endif
static void do_info_status_print(Monitor *mon, const QObject *data)
diff --git a/qmp-commands.hx b/qmp-commands.hx
index a9f109a..ae08b7a 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -430,6 +430,33 @@ Example:
EQMP
{
+ .name = "inject-nmi",
+ .args_type = "",
+ .params = "",
+ .help = "",
+ .user_print = monitor_user_noop,
+ .mhandler.cmd_new = do_inject_nmi_all,
+ },
+
+SQMP
+inject-nmi
+----------
+
+Inject an NMI on guest's CPUs.
+
+Arguments: None.
+
+Example:
+
+-> { "execute": "inject-nmi" }
+<- { "return": {} }
+
+Note: inject-nmi is only supported for x86 guest currently, it will
+ returns "Unsupported" error for non-x86 guest.
+
+EQMP
+
+ {
.name = "migrate",
.args_type = "detach:-d,blk:-b,inc:-i,uri:s",
.params = "[-d] [-b] [-i] uri",
--
1.7.4.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH 2/5] QMP: add inject-nmi qmp command
2011-06-01 15:54 ` [Qemu-devel] [PATCH 2/5] QMP: add inject-nmi qmp command Luiz Capitulino
@ 2011-06-04 8:34 ` Blue Swirl
2011-06-06 14:17 ` Luiz Capitulino
0 siblings, 1 reply; 12+ messages in thread
From: Blue Swirl @ 2011-06-04 8:34 UTC (permalink / raw)
To: Luiz Capitulino; +Cc: armbru, aliguori, Lai Jiangshan, qemu-devel
On Wed, Jun 1, 2011 at 6:54 PM, Luiz Capitulino <lcapitulino@redhat.com> wrote:
> From: Lai Jiangshan <laijs@cn.fujitsu.com>
>
> inject-nmi command injects an NMI on all CPUs of guest.
> It is only supported for x86 guest currently, it will
> returns "Unsupported" error for non-x86 guest.
Please rename the command to 'x-inject-nmi' to point out that it will
be replaced by a generic method later.
> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
> ---
> monitor.c | 17 +++++++++++++++++
> qmp-commands.hx | 27 +++++++++++++++++++++++++++
> 2 files changed, 44 insertions(+), 0 deletions(-)
>
> diff --git a/monitor.c b/monitor.c
> index f63cce0..81d3c9b 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -2555,6 +2555,23 @@ static void do_inject_nmi(Monitor *mon, const QDict *qdict)
> break;
> }
> }
> +
> +static int do_inject_nmi_all(Monitor *mon, const QDict *qdict, QObject **ret_data)
> +{
> + CPUState *env;
> +
> + for (env = first_cpu; env != NULL; env = env->next_cpu) {
> + cpu_interrupt(env, CPU_INTERRUPT_NMI);
> + }
> +
> + return 0;
> +}
> +#else
> +static int do_inject_nmi_all(Monitor *mon, const QDict *qdict, QObject **ret_data)
> +{
> + qerror_report(QERR_UNSUPPORTED);
> + return -1;
> +}
> #endif
>
> static void do_info_status_print(Monitor *mon, const QObject *data)
> diff --git a/qmp-commands.hx b/qmp-commands.hx
> index a9f109a..ae08b7a 100644
> --- a/qmp-commands.hx
> +++ b/qmp-commands.hx
> @@ -430,6 +430,33 @@ Example:
> EQMP
>
> {
> + .name = "inject-nmi",
> + .args_type = "",
> + .params = "",
> + .help = "",
> + .user_print = monitor_user_noop,
> + .mhandler.cmd_new = do_inject_nmi_all,
> + },
> +
> +SQMP
> +inject-nmi
> +----------
> +
> +Inject an NMI on guest's CPUs.
> +
> +Arguments: None.
> +
> +Example:
> +
> +-> { "execute": "inject-nmi" }
> +<- { "return": {} }
> +
> +Note: inject-nmi is only supported for x86 guest currently, it will
> + returns "Unsupported" error for non-x86 guest.
> +
> +EQMP
> +
> + {
> .name = "migrate",
> .args_type = "detach:-d,blk:-b,inc:-i,uri:s",
> .params = "[-d] [-b] [-i] uri",
> --
> 1.7.4.4
>
>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH 2/5] QMP: add inject-nmi qmp command
2011-06-04 8:34 ` Blue Swirl
@ 2011-06-06 14:17 ` Luiz Capitulino
2011-06-12 21:22 ` Blue Swirl
0 siblings, 1 reply; 12+ messages in thread
From: Luiz Capitulino @ 2011-06-06 14:17 UTC (permalink / raw)
To: Blue Swirl; +Cc: armbru, aliguori, Lai Jiangshan, qemu-devel
On Sat, 4 Jun 2011 11:34:17 +0300
Blue Swirl <blauwirbel@gmail.com> wrote:
> On Wed, Jun 1, 2011 at 6:54 PM, Luiz Capitulino <lcapitulino@redhat.com> wrote:
> > From: Lai Jiangshan <laijs@cn.fujitsu.com>
> >
> > inject-nmi command injects an NMI on all CPUs of guest.
> > It is only supported for x86 guest currently, it will
> > returns "Unsupported" error for non-x86 guest.
>
> Please rename the command to 'x-inject-nmi' to point out that it will
> be replaced by a generic method later.
Won't the generic interface be called 'inject'? In that case calling this
command 'inject-nmi' makes sense as it's exactly what the command does and
in the future it can be written in terms of the new 'inject' command.
>
> > Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
> > ---
> > monitor.c | 17 +++++++++++++++++
> > qmp-commands.hx | 27 +++++++++++++++++++++++++++
> > 2 files changed, 44 insertions(+), 0 deletions(-)
> >
> > diff --git a/monitor.c b/monitor.c
> > index f63cce0..81d3c9b 100644
> > --- a/monitor.c
> > +++ b/monitor.c
> > @@ -2555,6 +2555,23 @@ static void do_inject_nmi(Monitor *mon, const QDict *qdict)
> > break;
> > }
> > }
> > +
> > +static int do_inject_nmi_all(Monitor *mon, const QDict *qdict, QObject **ret_data)
> > +{
> > + CPUState *env;
> > +
> > + for (env = first_cpu; env != NULL; env = env->next_cpu) {
> > + cpu_interrupt(env, CPU_INTERRUPT_NMI);
> > + }
> > +
> > + return 0;
> > +}
> > +#else
> > +static int do_inject_nmi_all(Monitor *mon, const QDict *qdict, QObject **ret_data)
> > +{
> > + qerror_report(QERR_UNSUPPORTED);
> > + return -1;
> > +}
> > #endif
> >
> > static void do_info_status_print(Monitor *mon, const QObject *data)
> > diff --git a/qmp-commands.hx b/qmp-commands.hx
> > index a9f109a..ae08b7a 100644
> > --- a/qmp-commands.hx
> > +++ b/qmp-commands.hx
> > @@ -430,6 +430,33 @@ Example:
> > EQMP
> >
> > {
> > + .name = "inject-nmi",
> > + .args_type = "",
> > + .params = "",
> > + .help = "",
> > + .user_print = monitor_user_noop,
> > + .mhandler.cmd_new = do_inject_nmi_all,
> > + },
> > +
> > +SQMP
> > +inject-nmi
> > +----------
> > +
> > +Inject an NMI on guest's CPUs.
> > +
> > +Arguments: None.
> > +
> > +Example:
> > +
> > +-> { "execute": "inject-nmi" }
> > +<- { "return": {} }
> > +
> > +Note: inject-nmi is only supported for x86 guest currently, it will
> > + returns "Unsupported" error for non-x86 guest.
> > +
> > +EQMP
> > +
> > + {
> > .name = "migrate",
> > .args_type = "detach:-d,blk:-b,inc:-i,uri:s",
> > .params = "[-d] [-b] [-i] uri",
> > --
> > 1.7.4.4
> >
> >
> >
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH 2/5] QMP: add inject-nmi qmp command
2011-06-06 14:17 ` Luiz Capitulino
@ 2011-06-12 21:22 ` Blue Swirl
0 siblings, 0 replies; 12+ messages in thread
From: Blue Swirl @ 2011-06-12 21:22 UTC (permalink / raw)
To: Luiz Capitulino; +Cc: armbru, aliguori, Lai Jiangshan, qemu-devel
On Mon, Jun 6, 2011 at 5:17 PM, Luiz Capitulino <lcapitulino@redhat.com> wrote:
> On Sat, 4 Jun 2011 11:34:17 +0300
> Blue Swirl <blauwirbel@gmail.com> wrote:
>
>> On Wed, Jun 1, 2011 at 6:54 PM, Luiz Capitulino <lcapitulino@redhat.com> wrote:
>> > From: Lai Jiangshan <laijs@cn.fujitsu.com>
>> >
>> > inject-nmi command injects an NMI on all CPUs of guest.
>> > It is only supported for x86 guest currently, it will
>> > returns "Unsupported" error for non-x86 guest.
>>
>> Please rename the command to 'x-inject-nmi' to point out that it will
>> be replaced by a generic method later.
>
> Won't the generic interface be called 'inject'? In that case calling this
> command 'inject-nmi' makes sense as it's exactly what the command does and
> in the future it can be written in terms of the new 'inject' command.
This is a bit useless since the patch was committed, but I was pointed
out that 'inject' wasn't so great name, 'raise/lower/pulse' should
have been more precise. But I guess we can live with yet another poor
interface, so who cares what the name is.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH 3/5] HMP: Use QMP inject nmi implementation
2011-06-01 15:54 [Qemu-devel] [PULL 0/5]: Monitor queue Luiz Capitulino
2011-06-01 15:54 ` [Qemu-devel] [PATCH 1/5] QMP: QError: New QERR_UNSUPPORTED Luiz Capitulino
2011-06-01 15:54 ` [Qemu-devel] [PATCH 2/5] QMP: add inject-nmi qmp command Luiz Capitulino
@ 2011-06-01 15:54 ` Luiz Capitulino
2011-06-01 15:54 ` [Qemu-devel] [PATCH 4/5] QMP: add get_events(wait=True) option Luiz Capitulino
` (2 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: Luiz Capitulino @ 2011-06-01 15:54 UTC (permalink / raw)
To: aliguori; +Cc: qemu-devel, armbru
This **CHANGES** the human monitor "nmi" command behavior.
Currently it accepts an CPU argument which, when provided, will send
the NMI to the specified CPU. This feature is of discussable value
though and HMP shouldn't have more features than QMP, so let's use
QMP's instead (it's also simpler).
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
hmp-commands.hx | 9 +++++----
monitor.c | 16 ++--------------
qmp-commands.hx | 2 +-
3 files changed, 8 insertions(+), 19 deletions(-)
diff --git a/hmp-commands.hx b/hmp-commands.hx
index 834e6a8..6ad8806 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -740,10 +740,11 @@ ETEXI
#if defined(TARGET_I386)
{
.name = "nmi",
- .args_type = "cpu_index:i",
- .params = "cpu",
- .help = "inject an NMI on the given CPU",
- .mhandler.cmd = do_inject_nmi,
+ .args_type = "",
+ .params = "",
+ .help = "inject an NMI on all guest's CPUs",
+ .user_print = monitor_user_noop,
+ .mhandler.cmd_new = do_inject_nmi,
},
#endif
STEXI
diff --git a/monitor.c b/monitor.c
index 81d3c9b..6af6a4d 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2544,19 +2544,7 @@ static void do_wav_capture(Monitor *mon, const QDict *qdict)
#endif
#if defined(TARGET_I386)
-static void do_inject_nmi(Monitor *mon, const QDict *qdict)
-{
- CPUState *env;
- int cpu_index = qdict_get_int(qdict, "cpu_index");
-
- for (env = first_cpu; env != NULL; env = env->next_cpu)
- if (env->cpu_index == cpu_index) {
- cpu_interrupt(env, CPU_INTERRUPT_NMI);
- break;
- }
-}
-
-static int do_inject_nmi_all(Monitor *mon, const QDict *qdict, QObject **ret_data)
+static int do_inject_nmi(Monitor *mon, const QDict *qdict, QObject **ret_data)
{
CPUState *env;
@@ -2567,7 +2555,7 @@ static int do_inject_nmi_all(Monitor *mon, const QDict *qdict, QObject **ret_dat
return 0;
}
#else
-static int do_inject_nmi_all(Monitor *mon, const QDict *qdict, QObject **ret_data)
+static int do_inject_nmi(Monitor *mon, const QDict *qdict, QObject **ret_data)
{
qerror_report(QERR_UNSUPPORTED);
return -1;
diff --git a/qmp-commands.hx b/qmp-commands.hx
index ae08b7a..92c5c3a 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -435,7 +435,7 @@ EQMP
.params = "",
.help = "",
.user_print = monitor_user_noop,
- .mhandler.cmd_new = do_inject_nmi_all,
+ .mhandler.cmd_new = do_inject_nmi,
},
SQMP
--
1.7.4.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH 4/5] QMP: add get_events(wait=True) option
2011-06-01 15:54 [Qemu-devel] [PULL 0/5]: Monitor queue Luiz Capitulino
` (2 preceding siblings ...)
2011-06-01 15:54 ` [Qemu-devel] [PATCH 3/5] HMP: Use QMP inject nmi implementation Luiz Capitulino
@ 2011-06-01 15:54 ` Luiz Capitulino
2011-06-01 15:54 ` [Qemu-devel] [PATCH 5/5] QMP: add server mode to QEMUMonitorProtocol Luiz Capitulino
2011-06-09 12:40 ` [Qemu-devel] [PULL 0/5]: Monitor queue Anthony Liguori
5 siblings, 0 replies; 12+ messages in thread
From: Luiz Capitulino @ 2011-06-01 15:54 UTC (permalink / raw)
To: aliguori; +Cc: qemu-devel, Stefan Hajnoczi, armbru
From: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
The get_events() function polls for new QMP events and then returns. It
can be useful to wait for the next QMP event so add the boolean 'wait'
keyword argument.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
QMP/qmp.py | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/QMP/qmp.py b/QMP/qmp.py
index 14ce8b0..2565508 100644
--- a/QMP/qmp.py
+++ b/QMP/qmp.py
@@ -43,7 +43,7 @@ class QEMUMonitorProtocol:
family = socket.AF_UNIX
return socket.socket(family, socket.SOCK_STREAM)
- def __json_read(self):
+ def __json_read(self, only_event=False):
while True:
data = self.__sockfile.readline()
if not data:
@@ -51,7 +51,8 @@ class QEMUMonitorProtocol:
resp = json.loads(data)
if 'event' in resp:
self.__events.append(resp)
- continue
+ if not only_event:
+ continue
return resp
error = socket.error
@@ -106,9 +107,11 @@ class QEMUMonitorProtocol:
qmp_cmd['id'] = id
return self.cmd_obj(qmp_cmd)
- def get_events(self):
+ def get_events(self, wait=False):
"""
Get a list of available QMP events.
+
+ @param wait: block until an event is available (bool)
"""
self.__sock.setblocking(0)
try:
@@ -118,6 +121,8 @@ class QEMUMonitorProtocol:
# No data available
pass
self.__sock.setblocking(1)
+ if not self.__events and wait:
+ self.__json_read(only_event=True)
return self.__events
def clear_events(self):
--
1.7.4.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH 5/5] QMP: add server mode to QEMUMonitorProtocol
2011-06-01 15:54 [Qemu-devel] [PULL 0/5]: Monitor queue Luiz Capitulino
` (3 preceding siblings ...)
2011-06-01 15:54 ` [Qemu-devel] [PATCH 4/5] QMP: add get_events(wait=True) option Luiz Capitulino
@ 2011-06-01 15:54 ` Luiz Capitulino
2011-06-02 2:19 ` Brad Hards
2011-06-09 12:40 ` [Qemu-devel] [PULL 0/5]: Monitor queue Anthony Liguori
5 siblings, 1 reply; 12+ messages in thread
From: Luiz Capitulino @ 2011-06-01 15:54 UTC (permalink / raw)
To: aliguori; +Cc: qemu-devel, Stefan Hajnoczi, armbru
From: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
QEMU supports socket chardevs that establish connections like a server
or a client. The QEMUMonitorProtocol class only supports connecting as
a client. It is not possible to connect race-free when launching QEMU
since trying to connect before QEMU has bound and is listening on the
socket results in failure.
Add the QEMUMonitorProtocol(server=True) argument to bind and listen on
the socket. The QEMU process can then be launched and connects to the
already existing QMP socket without a race condition:
qmp = qmp.QEMUMonitorProtocol(monitor_path, server=True)
popen = subprocess.Popen(args)
qmp.accept()
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
QMP/qmp.py | 43 ++++++++++++++++++++++++++++++++-----------
1 files changed, 32 insertions(+), 11 deletions(-)
diff --git a/QMP/qmp.py b/QMP/qmp.py
index 2565508..c7dbea0 100644
--- a/QMP/qmp.py
+++ b/QMP/qmp.py
@@ -22,19 +22,24 @@ class QMPCapabilitiesError(QMPError):
pass
class QEMUMonitorProtocol:
- def __init__(self, address):
+ def __init__(self, address, server=False):
"""
Create a QEMUMonitorProtocol class.
@param address: QEMU address, can be either a unix socket path (string)
or a tuple in the form ( address, port ) for a TCP
connection
- @note No connection is established, this is done by the connect() method
+ @param server: server mode listens on the socket (bool)
+ @raise socket.error on socket connection errors
+ @note No connection is established, this is done by the connect() or
+ accept() methods
"""
self.__events = []
self.__address = address
self.__sock = self.__get_sock()
- self.__sockfile = self.__sock.makefile()
+ if server:
+ self.__sock.bind(self.__address)
+ self.__sock.listen(1)
def __get_sock(self):
if isinstance(self.__address, tuple):
@@ -43,6 +48,17 @@ class QEMUMonitorProtocol:
family = socket.AF_UNIX
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
+ # Greeting seems ok, negotiate capabilities
+ resp = self.cmd('qmp_capabilities')
+ if "return" in resp:
+ return greeting
+ raise QMPCapabilitiesError
+
def __json_read(self, only_event=False):
while True:
data = self.__sockfile.readline()
@@ -67,14 +83,19 @@ class QEMUMonitorProtocol:
@raise QMPCapabilitiesError if fails to negotiate capabilities
"""
self.__sock.connect(self.__address)
- greeting = self.__json_read()
- if greeting is None or not greeting.has_key('QMP'):
- raise QMPConnectError
- # Greeting seems ok, negotiate capabilities
- resp = self.cmd('qmp_capabilities')
- if "return" in resp:
- return greeting
- raise QMPCapabilitiesError
+ return self.__negotiate_capabilities()
+
+ def accept(self):
+ """
+ Await connection from QMP Monitor and perform capabilities negotiation.
+
+ @return QMP greeting dict
+ @raise socket.error on socket connection errors
+ @raise QMPConnectError if the greeting is not received
+ @raise QMPCapabilitiesError if fails to negotiate capabilities
+ """
+ self.__sock, _ = self.__sock.accept()
+ return self.__negotiate_capabilities()
def cmd_obj(self, qmp_cmd):
"""
--
1.7.4.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PULL 0/5]: Monitor queue
2011-06-01 15:54 [Qemu-devel] [PULL 0/5]: Monitor queue Luiz Capitulino
` (4 preceding siblings ...)
2011-06-01 15:54 ` [Qemu-devel] [PATCH 5/5] QMP: add server mode to QEMUMonitorProtocol Luiz Capitulino
@ 2011-06-09 12:40 ` Anthony Liguori
5 siblings, 0 replies; 12+ messages in thread
From: Anthony Liguori @ 2011-06-09 12:40 UTC (permalink / raw)
To: Luiz Capitulino; +Cc: qemu-devel, armbru
On 06/01/2011 10:54 AM, Luiz Capitulino wrote:
> Anthony,
>
> The following patches have been sent to the list and look good to me. I've
> also tested them.
>
> The changes (since 578c7b2ca8ee9e97fa8693b1a83d517e8e3f962e) are available
> in the following repository:
>
> git://repo.or.cz/qemu/qmp-unstable.git for-anthony
Pulled. Thanks.
Regards,
Anthony Liguori
>
> Lai Jiangshan (2):
> QMP: QError: New QERR_UNSUPPORTED
> QMP: add inject-nmi qmp command
>
> Luiz Capitulino (1):
> HMP: Use QMP inject nmi implementation
>
> Stefan Hajnoczi (2):
> QMP: add get_events(wait=True) option
> QMP: add server mode to QEMUMonitorProtocol
>
> QMP/qmp.py | 54 ++++++++++++++++++++++++++++++++++++++++--------------
> hmp-commands.hx | 9 +++++----
> monitor.c | 19 ++++++++++++-------
> qerror.c | 4 ++++
> qerror.h | 3 +++
> qmp-commands.hx | 27 +++++++++++++++++++++++++++
> 6 files changed, 91 insertions(+), 25 deletions(-)
>
>
>
^ permalink raw reply [flat|nested] 12+ messages in thread