On Thu, Nov 21, 2024 at 10:26:34AM +0000, Daniel P. Berrangé wrote: > On Wed, Nov 20, 2024 at 04:56:56PM -0500, Peter Xu wrote: > > Follow the trend to explicitly create containers, do that for console.c on > > "/backend" container. > > > > Cc: Marc-André Lureau <marcandre.lur...@redhat.com> > > Signed-off-by: Peter Xu <pet...@redhat.com> > > --- > > ui/console.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/ui/console.c b/ui/console.c > > index 5165f17125..36f8c6debb 100644 > > --- a/ui/console.c > > +++ b/ui/console.c > > @@ -1154,14 +1154,14 @@ DisplayState *init_displaystate(void) > > { > > gchar *name; > > QemuConsole *con; > > + Object *backend = container_create(object_get_root(), "backend"); > > What's the rationale for keeping this in the console code ? > > I'd consider this to be a similar situation to '/chardevs' and > '/objects', and be a common container rather than UI specific. > IOW, be created by your later patch.
I was trying to be careful on always create then on demand like before. E.g. I was thinking maybe this container shouldn't exist when there's no display at all. But looks like init_displaystate() is indeed always invoked for system code.. so yeah, perhaps I can move it over too, and drop this patch (below will be part of last patch to use objects_get_container() instead, or part of its splits). > > > > > QTAILQ_FOREACH(con, &consoles, next) { > > /* Hook up into the qom tree here (not in object_new()), once > > * all QemuConsoles are created and the order / numbering > > * doesn't change any more */ > > name = g_strdup_printf("console[%d]", con->index); > > - object_property_add_child(container_get(object_get_root(), > > "/backend"), > > - name, OBJECT(con)); > > + object_property_add_child(backend, name, OBJECT(con)); > > g_free(name); > > } > > > > With regards, > Daniel > -- > |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| > |: https://libvirt.org -o- https://fstop138.berrange.com :| > |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| > -- Peter Xu