On Wed, Nov 20, 2024 at 04:57:01PM -0500, Peter Xu wrote:
> Always explicitly create QEMU system containers upfront.
>
> Root containers will be created when trying to fetch the root object the
> 1st time. Machine sub-containers will be created only until machine is
> being initialized.
>
> Signed-off-by: Peter Xu <[email protected]>
> ---
> hw/core/machine.c | 19 ++++++++++++++++---
> qom/object.c | 16 +++++++++++++++-
> 2 files changed, 31 insertions(+), 4 deletions(-)
> diff --git a/qom/object.c b/qom/object.c
> index 214d6eb4c1..810e6f2bd9 100644
> --- a/qom/object.c
> +++ b/qom/object.c
> @@ -1734,12 +1734,26 @@ const char *object_property_get_type(Object *obj,
> const char *name, Error **errp
> return prop->type;
> }
>
> +static Object *object_root_initialize(void)
> +{
> + Object *root = object_new(TYPE_CONTAINER);
> +
> + /*
> + * Create all QEMU system containers. "machine" and its sub-containers
> + * are only created when machine initializes (qemu_create_machine()).
> + */
> + container_create(root, "chardevs");
> + container_create(root, "objects");
This is where I would expect 'backend' to have been created
rather than ui/console.c, though you could potentially make
a case to create it from the machine function, snice console
stuff can't be used outside of the machine context, while
chardevs/objects can be used in qemu-img/qemu-nbd, etc
> +
> + return root;
> +}
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 :|