[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



On 11/05/2012 08:02 AM, 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.

Hmm, this config option effectively renders autostart useless.  If
that's the case, I wonder if we should then also forbid people from
using virDomainSetAutostart to turn autostart on for a given domain.
[Reading further - oh, I found your example of 'virsh list --all
--autostart]

I really wonder if a better solution would be to add something to domain
XML that says whether autostart is enabled, and more importantly, gives
a delay for how long after libvirtd starts before that particular
domain's autostart is acted on.

That is, right now, autostart is an invisible property (not present in
virDomainGetXMLDesc; you have to use virDomainGetAutostart to learn
about it), with just a bool value of on or off.  But what if we modified
domain XML to display:

<autostart enabled='yes' delay='5'/>

meaning that this domain is set to autostart, but only after 5 seconds
have elapsed since the start of libvirtd?

> 
> 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.

Agree that these two won't work.

> 
> 3) Wait for certain amount of time.
>     - Very limited amount of control on diverse guests.

Limited, but at least expressible if you take my idea of exposing an
autostart delay in the domain XML.

> 
> 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

s/stil/still/

> benefits (virsh list --all --autostart).

If you use the config option to disable autostart, then there is no
autostart.  But I guess I see where you are coming from for at least
allowing the designation, even if libvirtd won't honor it, so that you
can at least filter domains based on those that were marked.

I also wonder if Michal's suggestion of making it a command-line option
rather than a config option is better - how easy or hard is it to inject
additional command line options into a systemd startup script?

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]