--- /usr/lib/stonith/plugins/external/libvirt 2011-10-24 10:59:26.000000000 +0100 +++ /usr/lib/stonith/plugins/external/libvirtm 2012-09-27 10:52:12.000000000 +0100 @@ -44,6 +44,21 @@ ha_log.sh err "$out" return 1 } +# reboot a domain +# return +# 0: success +# 1: error +libvirt_reboot() { + out=$($VIRSH -c $hypervisor_uri reboot $domain_id 2>&1) + if [ $? -eq 0 ] + then + ha_log.sh notice "Domain $domain_id was rebooted" + return 0 + fi + ha_log.sh err "Failed to reboot domain $domain_id" + ha_log.sh err "$out" + return 1 +} # stop a domain # return @@ -199,20 +214,11 @@ ;; reset) - # libvirt has no reset so we do a power cycle libvirt_check_config libvirt_set_domain_id $2 - libvirt_stop + libvirt_reboot rc=$? - [ $rc = 1 ] && exit 1 - - # stonith reset seems to require a power on even if it was off - # before so the next line is commented out - # [ $rc = 2 ] && exit 0 - - sleep 2 - libvirt_start exit $? ;;