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 <[email protected]> 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 <[email protected]>
> > ---
> > 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 :|