[libvirt] boot time delay for domains?

Hi folks, Is there a global "boot time delay" configuration parameter to make sure that the autostart domains are not started all in parallel at boot time? Any helpful comment would be highly appreciated. Harri

On Wed, Dec 22, 2010 at 13:32, Harald Dunkel <harald.dunkel@aixigo.de> wrote:
Is there a global "boot time delay" configuration parameter to make sure that the autostart domains are not started all in parallel at boot time?
AFAIK there is no such option.
Any helpful comment would be highly appreciated.
in domain XML you can change <emulator> tag and point to your script, which will start domain after some random delay e.g. something like this: <domain type='kvm'> <name>test</name> ... <devices> <emulator>/usr/bin/local/qemu-kvm-with-random-delay</emulator> <devices> </domain> # cat > /usr/bin/local/qemu-kvm-with-random-delay #!/bin/bash # delay running of virtual machine by 0-9 seconds sleep $(( $RANDOM % 10 )) exec /usr/bin/qemu-kvm $* ^D You can also detect if domain is started by libvirtd autostart feature or not. it could be enough that you will check if [ -f /var/lock/subsys/libvirtd ]. But I've not tested. If you'll have some solution share with us, please. -- Pawel

Anno domini 2010 Paweł Krześniak scripsit:
# cat > /usr/bin/local/qemu-kvm-with-random-delay #!/bin/bash # delay running of virtual machine by 0-9 seconds sleep $(( $RANDOM % 10 )) exec /usr/bin/qemu-kvm $* ^D
When using $* you might lose quoting of parameters. exec /usr/bin/qemu-kvm "$@" would preserve this. Ciao Max -- "Ich glaub', ich bin für Firmen nicht gut. Fünf Jahre, nachdem ich irgendwo angefanen hab', ticken die alle durch :-D Vor allem in den höheren Etagen. War bei [Ex-Firma] ja nicht wirklich anders :-P" -- Autor bekannt

On Wed, Dec 22, 2010 at 04:23:54PM +0100, Paweł Krześniak wrote:
If you'll have some solution share with us, please.
my solution was to make all my domains non-persistent. my application monitors the status of the domains and re-creates them if they disappear. this has some major advantages: 1) you can control the rate at which domains are started 2) you can restart domains if they crash 3) you can schedule tasks to perform on a domain when they're not running (in the interval between when a domain goes down and when your application brings it back up) 4) peace of mind -- you know for sure that random domains won't start up when you bring up a random machine. this helps avoid vm disk corruption. this reason will be less important once libvirt finalizes the locking infrastructure, but right now it's critical for me --igor
participants (4)
-
Harald Dunkel
-
Igor Serebryany
-
Maximilian Wilhelm
-
Paweł Krześniak