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

Daniel P. Berrange berrange at redhat.com
Tue Nov 6 13:57:30 UTC 2012

On Mon, Nov 05, 2012 at 04:02:28PM +0100, 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(-)

I sort wonder whether it is better to expose this as a command line
argument rather than a config option. It would make life much easier
for people who want to have autostart running most of the time, but
occassionally want to start libvirtd without it.

|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

More information about the libvir-list mailing list