[libvirt] boot time delay for domains?

Paweł Krześniak pawel.krzesniak at gmail.com
Wed Dec 22 15:23:54 UTC 2010


On Wed, Dec 22, 2010 at 13:32, Harald Dunkel <harald.dunkel at 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




More information about the libvir-list mailing list