[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PULL 11/13] monitor: add object-add (QMP) and object_a
From: |
Luiz Capitulino |
Subject: |
Re: [Qemu-devel] [PULL 11/13] monitor: add object-add (QMP) and object_add (HMP) command |
Date: |
Fri, 20 Dec 2013 08:33:25 -0500 |
On Fri, 20 Dec 2013 12:15:53 +1000
Peter Crosthwaite <address@hidden> wrote:
> On Thu, Dec 19, 2013 at 3:00 AM, Luiz Capitulino <address@hidden> wrote:
> > From: Paolo Bonzini <address@hidden>
> >
> > Add two commands that are the monitor counterparts of -object. The commands
> > have the same Visitor-based implementation, but use different kinds of
> > visitors so that the HMP command has a DWIM string-based syntax, while
> > the QMP variant accepts a stricter JSON-based properties dictionary.
> >
> > Signed-off-by: Paolo Bonzini <address@hidden>
> > Reviewed-By: Igor Mammedov <address@hidden>
> > Signed-off-by: Luiz Capitulino <address@hidden>
> > ---
> > hmp-commands.hx | 14 +++++++++++
> > hmp.c | 58 ++++++++++++++++++++++++++++++++++++++++++++
> > hmp.h | 1 +
> > include/monitor/monitor.h | 3 +++
> > include/qapi/visitor.h | 3 +--
> > include/qemu/typedefs.h | 2 ++
> > qapi-schema.json | 20 +++++++++++++++
> > qmp-commands.hx | 27 +++++++++++++++++++++
> > qmp.c | 62
> > +++++++++++++++++++++++++++++++++++++++++++++++
> > 9 files changed, 188 insertions(+), 2 deletions(-)
> >
> > diff --git a/hmp-commands.hx b/hmp-commands.hx
> > index ebe8e78..2951d1e 100644
> > --- a/hmp-commands.hx
> > +++ b/hmp-commands.hx
> > @@ -1243,6 +1243,20 @@ STEXI
> > Remove host network device.
> > ETEXI
> >
> > + {
> > + .name = "object_add",
> > + .args_type = "object:O",
> > + .params = "[qom-type=]type,id=str[,prop=value][,...]",
> > + .help = "create QOM object",
> > + .mhandler.cmd = hmp_object_add,
> > + },
> > +
> > +STEXI
> > address@hidden object_add
> > address@hidden object_add
> > +Create QOM object.
> > +ETEXI
> > +
> > #ifdef CONFIG_SLIRP
> > {
> > .name = "hostfwd_add",
> > diff --git a/hmp.c b/hmp.c
> > index 32ee285..a1669ab 100644
> > --- a/hmp.c
> > +++ b/hmp.c
> > @@ -21,6 +21,7 @@
> > #include "qmp-commands.h"
> > #include "qemu/sockets.h"
> > #include "monitor/monitor.h"
> > +#include "qapi/opts-visitor.h"
> > #include "ui/console.h"
> > #include "block/qapi.h"
> > #include "qemu-io.h"
> > @@ -1354,6 +1355,63 @@ void hmp_netdev_del(Monitor *mon, const QDict *qdict)
> > hmp_handle_error(mon, &err);
> > }
> >
> > +void hmp_object_add(Monitor *mon, const QDict *qdict)
> > +{
> > + Error *err = NULL;
> > + QemuOpts *opts;
> > + char *type = NULL;
> > + char *id = NULL;
> > + void *dummy = NULL;
> > + OptsVisitor *ov;
> > + QDict *pdict;
> > +
> > + opts = qemu_opts_from_qdict(qemu_find_opts("object"), qdict, &err);
> > + if (error_is_set(&err)) {
> > + goto out;
> > + }
> > +
> > + ov = opts_visitor_new(opts);
> > + pdict = qdict_clone_shallow(qdict);
> > +
> > + visit_start_struct(opts_get_visitor(ov), &dummy, NULL, NULL, 0, &err);
> > + if (error_is_set(&err)) {
> > + goto out_clean;
> > + }
> > +
> > + qdict_del(pdict, "qom-type");
> > + visit_type_str(opts_get_visitor(ov), &type, "qom-type", &err);
> > + if (error_is_set(&err)) {
> > + goto out_clean;
> > + }
> > +
> > + qdict_del(pdict, "id");
> > + visit_type_str(opts_get_visitor(ov), &id, "id", &err);
> > + if (error_is_set(&err)) {
> > + goto out_clean;
> > + }
> > +
> > + object_add(type, id, pdict, opts_get_visitor(ov), &err);
> > + if (error_is_set(&err)) {
> > + goto out_clean;
> > + }
> > + visit_end_struct(opts_get_visitor(ov), &err);
> > + if (error_is_set(&err)) {
> > + qmp_object_del(id, NULL);
>
> This is not bisect-able as you add this function in the next commit:
Thanks for catching it. This was a bad pull request.
Paolo, can resend?
- [Qemu-devel] [PULL 00/13] QMP queue, Luiz Capitulino, 2013/12/18
- [Qemu-devel] [PULL 11/13] monitor: add object-add (QMP) and object_add (HMP) command, Luiz Capitulino, 2013/12/18
- [Qemu-devel] [PULL 12/13] monitor: add object-del (QMP) and object_del (HMP) command, Luiz Capitulino, 2013/12/18
- [Qemu-devel] [PULL 13/13] qemu-monitor: HMP cpu-add wrapper, Luiz Capitulino, 2013/12/18
- [Qemu-devel] [PULL 01/13] vl: add missing transition debug->finish_migrate, Luiz Capitulino, 2013/12/18
- [Qemu-devel] [PULL 06/13] qemu-option: Remove qemu_opts_create_nofail, Luiz Capitulino, 2013/12/18
- [Qemu-devel] [PULL 03/13] hw/core/qdev: Delete dead code, Luiz Capitulino, 2013/12/18
- [Qemu-devel] [PULL 02/13] error: Add error_abort, Luiz Capitulino, 2013/12/18
- [Qemu-devel] [PULL 04/13] hw: Remove assert_no_error usages, Luiz Capitulino, 2013/12/18
- [Qemu-devel] [PULL 08/13] rng: initialize file descriptor to -1, Luiz Capitulino, 2013/12/18
- [Qemu-devel] [PULL 09/13] qom: fix leak for objects created with -object, Luiz Capitulino, 2013/12/18
- [Qemu-devel] [PULL 05/13] target-i386: Remove assert_no_error usage, Luiz Capitulino, 2013/12/18