KVm Boot Vms with DRBD

vitor costa

Renowned Member
Oct 28, 2009
142
2
83
I have some DRBD cluster (6 clusters). The Option START ON BOOT apear not work in Vms storaged in DRBD. Vms in local storage start at boot ok, but not the DRBD storage.

One cluster have 2 TB storage and another 500GB. After boot host,, i can log on and cat /proc/drbd show the DRBD resync process...take some time (2 - 3 minutes). I think KVM machins cant start while resync....

Are any way to program QEMU-SERVER to wait some minutes before load ? Or anther way to solve the question ?
 
Seems like DRBD ressources are started later than qemu-server. Try changing the startup order. E.g. like this moving drbd to startup order 23 (qemu-server is 24 here):
Code:
update-rc.d -f drbd remove
update-rc.d drbd start 23 2 3 4 5 . stop 08 0 1 6 .

Best regards,
Bo
 
Tanks Bohanse, your solution works very nice.

Proxmox Team, is possible make this as default situation (in distro) ?

Another question:

- With this change the VMs boot when host boot, but the drbd sync process take 2-5 minutes with Vm already runing. The Sync Data will come from another node to node where VM is runing.. so if VM after boot start write data on virtual disc this will be colide situation ! or not ?
 
Dietmar,

I think is needed a script in qemu-server start to check drbd is syncing,.. if is then wait... This script can test cat /proc/drbd for syncing word, waiting while found and continue when not found (if splitbrain or another condidion the syncing will desapear and the qemu start anyway).
 
I made this script:

Code:
while $flag; do

    result_dr=`grep -o Sync /proc/drbd`

    if [ $result_dr ]; then
        flag=true
    else
        flag=false
    fi
    sleep 3
done
Put in /usr/sbin , then insert a call in /etc/init.d/qemu-server:

Code:
case "$1" in
  start)
        (egrep '^flags.*svm' /proc/cpuinfo >/dev/null && modprobe -q kvm-amd) ||
        (egrep '^flags.*vmx' /proc/cpuinfo >/dev/null && modprobe -q kvm-intel) ||
        echo "unable to load kvm module"

        modprobe -q vhost_net || true
        /usr/sbin/wait-drbd
        $PROG startall
        ;;
All is working Now.
 
Last edited: