From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Peter Xu <peterx@redhat.com>
Cc: "Fabiano Rosas" <farosas@suse.de>,
qemu-devel@nongnu.org, qemu-arm@nongnu.org,
"Cédric Le Goater" <clg@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@mailo.com>,
"Vladimir Sementsov-Ogievskiy" <vsementsov@yandex-team.ru>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Dr . David Alan Gilbert" <dave@treblig.org>,
"Eric Blake" <eblake@redhat.com>,
"Akihiko Odaki" <odaki@rsg.ci.i.u-tokyo.ac.jp>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Kevin Wolf" <kwolf@redhat.com>,
"Sana Sharma" <sansshar@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Juraj Marcin" <jmarcin@redhat.com>,
qemu-rust@nongnu.org, "Markus Armbruster" <armbru@redhat.com>,
"Mark Cave-Ayland" <mark.caveayland@nutanix.com>
Subject: Re: [PATCH v2 00/10] migration/qom: Remove TYPE_DEVICE dependency on migration object
Date: Thu, 11 Jun 2026 14:31:06 +0100 [thread overview]
Message-ID: <aiq4mkFnRwek-_j4@redhat.com> (raw)
In-Reply-To: <aimtYbka4GB9Qyk6@x1.local>
On Wed, Jun 10, 2026 at 02:30:57PM -0400, Peter Xu wrote:
> On Tue, Jun 09, 2026 at 07:54:56PM -0300, Fabiano Rosas wrote:
> > Hi,
> >
> > After we discussed your v1 I started playing with this in parallel and
> > stumbled into pretty much all of the issues this series resolves. Nice
> > work!
>
> Good to know at least it looks reasonable for someone.. thanks. :)
>
> Looks like Dan still has concern that I use the ptrs in obj props but I'll
> discuss it later separately.
>
> >
> > I applied a patch [0] on top of this series to allow using the
> > command-line to create the migration object. It can set all (most)
> > options with -object migration,id=mig1,key=val,...
> >
> > $ ~/qemu-system-x86_64 -nodefaults -nographic -S \
> > -object migration,id=mig1,announce-initial=99,downtime-limit=99,multifd-channels=99,multifd-compression=zlib,multifd=on
> > ...
> > (qemu) info migrate_parameters
> > (qemu) info migrate_capabilities
> > ...
> > announce-initial: 99 ms
> > downtime-limit: 99 ms
> > multifd-channels: 99
> > multifd-compression: zlib
> > multifd: on
> >
> > I'm not saying we should do that now. I just want to check with you to
> > make sure we're not closing the door for future improvements:
>
> IIUC it works, maybe indeed it's a better way than "-incoming config:" at
> least in that we stick with the current APIs.
>
> Said that, it does bypass the singleton work I did previously:
>
> https://lore.kernel.org/r/20241029211607.2114845-1-peterx@redhat.com
You can force a QOM object into being a singleton if you like.
In the UserCreatable interface "complete" callback, for the first
instance that's completed, stash its pointer in a global var,
and then when subsequent instances are created have "complete"
always report an error.
> > 1) It seems the "help" option is tied to the class. Setting options
> > work, but the help says otherwise:
> >
> > $ ~/qemu-system-x86_64 -nographic -object migration,id=mig1,help
> > There are no options for migration.
>
> This one is easy, something like this should work:
This is an example of why this needs to be using class properties,
not instance properties.
> bool type_print_class_properties(const char *type)
> {
> + g_autoptr(Object) obj = NULL;
> ObjectClass *klass;
> ObjectPropertyIterator iter;
> ObjectProperty *prop;
> @@ -134,7 +135,12 @@ bool type_print_class_properties(const char *type)
> }
>
> array = g_ptr_array_new();
> - object_class_property_iter_init(&iter, klass);
> + if (object_class_is_abstract(klass)) {
> + object_class_property_iter_init(&iter, klass);
> + } else {
> + obj = object_new_with_class(klass);
> + object_property_iter_init(&iter, obj);
> + }
> while ((prop = object_property_iter_next(&iter))) {
> if (!prop->set) {
> continue;
No, we don't want to do that - everything intended to be used
with -object needs to be using class properties.
> > diff --git a/migration/migration.c b/migration/migration.c
> > index ae0c373549..22c8ced766 100644
> > --- a/migration/migration.c
> > +++ b/migration/migration.c
> > @@ -297,7 +297,16 @@ void migration_object_init(void)
> > {
> > /* This can only be called once. */
> > assert(!current_migration);
> > - current_migration = MIGRATION(object_new(TYPE_MIGRATION));
> > +
> > + Object *root = object_get_objects_root();
> > + ObjectProperty *prop = g_hash_table_lookup(root->properties, "mig1");
> > +
> > + if (prop->opaque) {
> > + current_migration = prop->opaque;
> > + object_ref(current_migration);
> > + } else {
> > + current_migration = MIGRATION(object_new(TYPE_MIGRATION));
> > + }
>
> A quick comment for this one; maybe better with:
>
> Object *mig_obj = object_resolve_path_component(object_get_objects_root(),
> "mig1");
>
> Or even better:
>
> static int find_migration_object(Object *obj, void *opaque)
> {
> if (object_dynamic_cast(obj, TYPE_MIGRATION)) {
> *(Object **)opaque = obj;
> return 1;
> }
> return 0;
> }
>
> Then:
>
> object_child_foreach(object_get_objects_root(),
> find_migration_object, &existing);
If you want a singleton pattern, then it is simpler to just stash
the "Migration" object pointer in the "complete" method, and not
assume anything about the ID name the mgmt app chose to use.
With regards,
Daniel
--
|: https://berrange.com ~~ https://hachyderm.io/@berrange :|
|: https://libvirt.org ~~ https://entangle-photo.org :|
|: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
prev parent reply other threads:[~2026-06-11 13:32 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-09 17:25 [PATCH v2 00/10] migration/qom: Remove TYPE_DEVICE dependency on migration object Peter Xu
2026-06-09 17:25 ` [PATCH v2 01/10] migration: Use OBJECT_DECLARE_SIMPLE_TYPE Peter Xu
2026-06-09 22:55 ` Fabiano Rosas
2026-06-10 13:56 ` Daniel P. Berrangé
2026-06-10 15:15 ` Mark Cave-Ayland
2026-06-09 17:25 ` [PATCH v2 02/10] qdev: Export global_props() Peter Xu
2026-06-09 22:55 ` Fabiano Rosas
2026-06-10 15:18 ` Mark Cave-Ayland
2026-06-09 17:25 ` [PATCH v2 03/10] qdev: Introduce DEFINE_PROP_*_NODEFAULT for bool/uint32 Peter Xu
2026-06-10 15:25 ` Mark Cave-Ayland
2026-06-09 17:25 ` [PATCH v2 04/10] hw/arm: Use nodefault version of qdev props when not needed Peter Xu
2026-06-10 15:31 ` Mark Cave-Ayland
2026-06-09 17:25 ` [PATCH v2 05/10] qom: Create object-property-ptr.[ch] Peter Xu
2026-06-10 16:15 ` Daniel P. Berrangé
2026-06-10 18:39 ` Peter Xu
2026-06-10 20:37 ` Fabiano Rosas
2026-06-11 13:52 ` Daniel P. Berrangé
2026-06-11 14:36 ` Fabiano Rosas
2026-06-11 14:40 ` Daniel P. Berrangé
2026-06-11 12:54 ` Mark Cave-Ayland
2026-06-11 13:53 ` Peter Xu
2026-06-09 17:25 ` [PATCH v2 06/10] qom: Add object_property_add_bool_ptr() Peter Xu
2026-06-09 23:18 ` Fabiano Rosas
2026-06-11 12:59 ` Mark Cave-Ayland
2026-06-09 17:25 ` [PATCH v2 07/10] qom: Add object_property_add_size_ptr() Peter Xu
2026-06-09 23:18 ` Fabiano Rosas
2026-06-09 17:25 ` [PATCH v2 08/10] qom: Add object_property_add_*_ptr_def() Peter Xu
2026-06-09 23:21 ` Fabiano Rosas
2026-06-11 14:03 ` Mark Cave-Ayland
2026-06-09 17:25 ` [PATCH v2 09/10] qom: Allow default values for instance properties Peter Xu
2026-06-10 16:19 ` Daniel P. Berrangé
2026-06-11 14:08 ` Mark Cave-Ayland
2026-06-11 14:17 ` Daniel P. Berrangé
2026-06-11 15:24 ` Mark Cave-Ayland
2026-06-09 17:25 ` [PATCH v2 10/10] migration: Switch to TYPE_OBJECT with object properties Peter Xu
2026-06-10 16:13 ` Daniel P. Berrangé
2026-06-10 18:46 ` Peter Xu
2026-06-10 19:53 ` Fabiano Rosas
2026-06-10 20:18 ` Fabiano Rosas
2026-06-10 16:29 ` Daniel P. Berrangé
2026-06-10 18:51 ` Peter Xu
2026-06-09 22:54 ` [PATCH v2 00/10] migration/qom: Remove TYPE_DEVICE dependency on migration object Fabiano Rosas
2026-06-10 18:30 ` Peter Xu
2026-06-11 13:31 ` Daniel P. Berrangé [this message]
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=aiq4mkFnRwek-_j4@redhat.com \
--to=berrange@redhat.com \
--cc=armbru@redhat.com \
--cc=clg@redhat.com \
--cc=dave@treblig.org \
--cc=eblake@redhat.com \
--cc=farosas@suse.de \
--cc=jmarcin@redhat.com \
--cc=kwolf@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=mark.caveayland@nutanix.com \
--cc=odaki@rsg.ci.i.u-tokyo.ac.jp \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=peterx@redhat.com \
--cc=philmd@mailo.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-rust@nongnu.org \
--cc=sansshar@redhat.com \
--cc=vsementsov@yandex-team.ru \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.