From: "Daniel P. Berrangé" <berrange@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: "Peter Xu" <peterx@redhat.com>,
qemu-devel@nongnu.org, "Fabiano Rosas" <farosas@suse.de>,
"Juraj Marcin" <jmarcin@redhat.com>,
"Vladimir Sementsov-Ogievskiy" <vsementsov@yandex-team.ru>,
"Sana Sharma" <sansshar@redhat.com>,
"Eric Blake" <eblake@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Kevin Wolf" <kwolf@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@mailo.com>,
"Mark Cave-Ayland" <mark.caveayland@nutanix.com>,
"Akihiko Odaki" <odaki@rsg.ci.i.u-tokyo.ac.jp>,
"Cédric Le Goater" <clg@redhat.com>,
"Dr . David Alan Gilbert" <dave@treblig.org>
Subject: Re: [PATCH 4/4] migration: Remove dependency to TYPE_DEVICE
Date: Fri, 5 Jun 2026 09:49:20 +0100 [thread overview]
Message-ID: <aiKNkDvO0cx92zz-@redhat.com> (raw)
In-Reply-To: <CAJ+F1CLLOd0YUkaQifbzn5vDDh28UAv2=8Z3vpb9BNRYd-JYaQ@mail.gmail.com>
On Fri, Jun 05, 2026 at 12:30:01PM +0400, Marc-André Lureau wrote:
> Hi
>
> On Fri, Jun 5, 2026 at 3:12 AM Peter Xu <peterx@redhat.com> wrote:
> >
> > While doing that, we still want to keep the Property list that migration
> > object used to use. Apply them directly to ObjectClass instead of setting
> > them with a DeviceClass.
> >
> > Manually apply the two extra properties (compat properties, global
> > settings) in an instance_post_init() hook, just like most of the rest
> > users, see callers of object_apply_compat_props().
> >
> > Signed-off-by: Peter Xu <peterx@redhat.com>
> > ---
> > migration/migration.h | 2 +-
> > migration/migration.c | 33 +++++++++++++++++++--------------
> > 2 files changed, 20 insertions(+), 15 deletions(-)
> >
> > diff --git a/migration/migration.h b/migration/migration.h
> > index 841f49b215..8bdb8e8e6b 100644
> > --- a/migration/migration.h
> > +++ b/migration/migration.h
> > @@ -274,7 +274,7 @@ struct MigrationClass {
> >
> > struct MigrationState {
> > /*< private >*/
> > - DeviceState parent_obj;
> > + Object parent_obj;
> >
>
> You need to change MigrationClass.parent_class too
Do we even need a MigrationClass struct ? It has nothing except
the parent_class field, so feels redundant. Could the code just
use OBJECT_DECLARE_SIMPLE_TYPE instead.
>
> > /*< public >*/
> > QemuThread thread;
> > diff --git a/migration/migration.c b/migration/migration.c
> > index 074d3f2c69..f9f102e78a 100644
> > --- a/migration/migration.c
> > +++ b/migration/migration.c
> > @@ -3966,11 +3966,9 @@ fail:
> >
> > static void migration_class_init(ObjectClass *klass, const void *data)
> > {
> > - DeviceClass *dc = DEVICE_CLASS(klass);
> > -
> > - dc->user_creatable = false;
> > - device_class_set_props_n(dc, migration_properties,
> > - migration_properties_count);
> > + for (int i = 0; i < migration_properties_count; i++) {
> > + object_class_add_property(klass, &migration_properties[i]);
> > + }
This could get rid of migration_properties array indirection and call
object_class_property_add directly, avoiding the need for the previous
patch.
> > +static const TypeInfo migration_type = {
> > + .name = TYPE_MIGRATION,
> > + .parent = TYPE_OBJECT,
> > .class_init = migration_class_init,
> > - .class_size = sizeof(MigrationClass),
> > + .class_size = sizeof(ObjectClass),
>
> and this should still be MigrationClass
Not if we use OBJECT_DECLARE_SIMPLE_TYPE
>
> > .instance_size = sizeof(MigrationState),
> > .instance_init = migration_instance_init,
> > + .instance_post_init = migration_instance_post_init,
> > .instance_finalize = migration_instance_finalize,
> > };
> >
> > --
> > 2.53.0
> >
> >
>
> Otherwise, the series is good to me!
>
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 :|
next prev parent reply other threads:[~2026-06-05 8:50 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-04 23:11 [PATCH 0/4] migration/qdev: Remove TYPE_DEVICE dependency on migration object Peter Xu
2026-06-04 23:11 ` [PATCH 1/4] qdev: Pave way for exporting Property to be used in non-qdev Peter Xu
2026-06-05 10:53 ` Mark Cave-Ayland
2026-06-05 15:18 ` Fabiano Rosas
2026-06-05 14:39 ` Fabiano Rosas
2026-06-05 15:40 ` Peter Xu
2026-06-04 23:11 ` [PATCH 2/4] qdev: Introduce helper object_apply_globals() Peter Xu
2026-06-05 8:52 ` Daniel P. Berrangé
2026-06-05 14:44 ` Fabiano Rosas
2026-06-05 14:47 ` Daniel P. Berrangé
2026-06-05 15:06 ` Fabiano Rosas
2026-06-04 23:11 ` [PATCH 3/4] qdev: Refactor and rename of qdev_class_add_property() Peter Xu
2026-06-05 8:43 ` Daniel P. Berrangé
2026-06-05 15:21 ` Peter Xu
2026-06-04 23:11 ` [PATCH 4/4] migration: Remove dependency to TYPE_DEVICE Peter Xu
2026-06-05 8:30 ` Marc-André Lureau
2026-06-05 8:49 ` Daniel P. Berrangé [this message]
2026-06-05 15:36 ` Peter Xu
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=aiKNkDvO0cx92zz-@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=peterx@redhat.com \
--cc=philmd@mailo.com \
--cc=qemu-devel@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.