From: Luiz Capitulino <lcapitulino@redhat.com>
To: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
Anthony Liguori <anthony@codemonkey.ws>,
Igor Mammedov <imammedo@redhat.com>
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 [thread overview]
Message-ID: <20131220083325.4e5435ce@redhat.com> (raw)
In-Reply-To: <CAEgOgz7x9o-on-ARcZDwNWsdzuFR3qHsj8VmcunMaTS=igasXw@mail.gmail.com>
On Fri, 20 Dec 2013 12:15:53 +1000
Peter Crosthwaite <peter.crosthwaite@xilinx.com> wrote:
> On Thu, Dec 19, 2013 at 3:00 AM, Luiz Capitulino <lcapitulino@redhat.com> wrote:
> > From: Paolo Bonzini <pbonzini@redhat.com>
> >
> > 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 <pbonzini@redhat.com>
> > Reviewed-By: Igor Mammedov <imammedo@redhat.com>
> > Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
> > ---
> > 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
> > +@item object_add
> > +@findex 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?
next prev parent reply other threads:[~2013-12-20 13:35 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-18 16:59 [Qemu-devel] [PULL 00/13] QMP queue Luiz Capitulino
2013-12-18 16:59 ` [Qemu-devel] [PULL 01/13] vl: add missing transition debug->finish_migrate Luiz Capitulino
2013-12-18 16:59 ` [Qemu-devel] [PULL 02/13] error: Add error_abort Luiz Capitulino
2013-12-18 16:59 ` [Qemu-devel] [PULL 03/13] hw/core/qdev: Delete dead code Luiz Capitulino
2013-12-18 16:59 ` [Qemu-devel] [PULL 04/13] hw: Remove assert_no_error usages Luiz Capitulino
2013-12-18 16:59 ` [Qemu-devel] [PULL 05/13] target-i386: Remove assert_no_error usage Luiz Capitulino
2013-12-18 16:59 ` [Qemu-devel] [PULL 06/13] qemu-option: Remove qemu_opts_create_nofail Luiz Capitulino
2013-12-18 16:59 ` [Qemu-devel] [PULL 07/13] qerror: Remove assert_no_error() Luiz Capitulino
2013-12-18 16:59 ` [Qemu-devel] [PULL 08/13] rng: initialize file descriptor to -1 Luiz Capitulino
2013-12-18 16:59 ` [Qemu-devel] [PULL 09/13] qom: fix leak for objects created with -object Luiz Capitulino
2013-12-18 17:00 ` [Qemu-devel] [PULL 10/13] qom: catch errors in object_property_add_child Luiz Capitulino
2013-12-18 19:09 ` Andreas Färber
2013-12-18 19:58 ` Markus Armbruster
2013-12-18 22:17 ` Luiz Capitulino
2013-12-20 2:27 ` Peter Crosthwaite
2013-12-18 17:00 ` [Qemu-devel] [PULL 11/13] monitor: add object-add (QMP) and object_add (HMP) command Luiz Capitulino
2013-12-20 2:15 ` Peter Crosthwaite
2013-12-20 13:33 ` Luiz Capitulino [this message]
2013-12-18 17:00 ` [Qemu-devel] [PULL 12/13] monitor: add object-del (QMP) and object_del " Luiz Capitulino
2013-12-18 17:00 ` [Qemu-devel] [PULL 13/13] qemu-monitor: HMP cpu-add wrapper Luiz Capitulino
2013-12-20 0:32 ` [Qemu-devel] [PULL 00/13] QMP queue Peter Maydell
2013-12-20 0:44 ` Li Guang
2013-12-20 0:49 ` Anthony Liguori
2013-12-20 4:00 ` Peter Crosthwaite
2013-12-20 13:28 ` Luiz Capitulino
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=20131220083325.4e5435ce@redhat.com \
--to=lcapitulino@redhat.com \
--cc=anthony@codemonkey.ws \
--cc=imammedo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.crosthwaite@xilinx.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).