[libvirt] [PATCH] qemu: Add ability to disable autostarting of guests on daemon start

Michal Privoznik mprivozn at redhat.com
Mon Nov 5 15:10:41 UTC 2012


On 05.11.2012 16:02, Peter Krempa wrote:
> When the daemon is starting it autostarts all guests marked as
> autostartable. This is not an ideal solution for autostarting if there's
> a lot of domains configured so. After autostarting all right away the
> guests start competing for disk I/O and the boot is prolonged
> unnecessarily.
> 
> This patch adds a config option to disable autostarting to leave it on
> user scripts that may use mechanisms to reduce load of the host by
> limiting the number of guests started in parallel.
> 
> Unfortunately, there's no simple way we could do this in libvirt. The
> problem is how to detect that the guest has finished booting as it's
> mostly a black box for libvirt. There area few options:
> 
> 1) Wait until I/O load of the guest drops.
>     - This is insufficient on guests that do heavy I/O all the time.
> 
> 2) Let the guest tell us.
>     - Not every OS has the ability to have a guest agent.
> 
> 3) Wait for certain amount of time.
>     - Very limited amount of control on diverse guests.
> 
> With this functionality, the user may write his own script that load
> balances the autostart in a sane way with accordance to his
> infrastructure (Query agents, check I/O, use configurable timeouts)
> while stil being able to mark the domains as autostartable with all the
> benefits (virsh list --all --autostart).
> ---
> We could also add an example script based on parts of libvirt-guests to show
> how to use this.
> ---
>  src/qemu/qemu.conf     | 7 +++++++
>  src/qemu/qemu_conf.c   | 4 ++++
>  src/qemu/qemu_conf.h   | 2 ++
>  src/qemu/qemu_driver.c | 5 ++++-
>  4 files changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf
> index dd853c8..91115bf 100644
> --- a/src/qemu/qemu.conf
> +++ b/src/qemu/qemu.conf
> @@ -2,6 +2,13 @@
>  # All settings described here are optional - if omitted, sensible
>  # defaults are used.
> 
> +# When the qemu driver starts all guests that are marked to be
> +# started automaticaly are started (at once). This option disables
> +# autostarting of the guests. The user can use a script to do so in
> +# a more sensible way. Eg. wait for guest to start up, before continuing.
> +#
> +#disable_autostart = 1
> +


While I agree that disabling autostart may be desired, I wonder if we
can introduce command line argument instead/as well, e.g.:

libvirtd --disable-autostart

I think it's a bit more handy.

Michal




More information about the libvir-list mailing list