1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-24 21:34:01 +03:00

Feature #1639: fault tolerance hook rescheds VMs from unknown

(cherry picked from commit c5f0bc26366e93f528060b825ac4b8507cf6aef3)
(cherry picked from commit 674bacc122f61ea392e7420a83a0c2770630be16)
This commit is contained in:
Carlos Martín 2014-08-12 15:56:14 +02:00 committed by Ruben S. Montero
parent e9308b7539
commit d874c9f940
2 changed files with 9 additions and 0 deletions

View File

@ -619,6 +619,8 @@ HM_MAD = [
# This hook is used to perform recovery actions when a host fails.
# Script to implement host failure tolerance
# It can be set to
# -m migrate VMs to another host.
# State will be lost. Only for shared storage
# -r recreate VMs running in the host
# -d delete VMs running in the host
# Additional flags

View File

@ -19,6 +19,8 @@
####################################################
# Script to implement host failure tolerance
# It can be set to
# -m migrate VMs to another host.
# State will be lost. Only for shared storage
# -r recreate VMs running in the host
# -d delete VMs running in the host
# Additional flags
@ -55,6 +57,7 @@ force = "n" # By default, don't recreate/delete suspended VMs
repeat = nil # By default, don't wait for monitorization cycles"
opts = GetoptLong.new(
['--migrate', '-m',GetoptLong::NO_ARGUMENT],
['--delete', '-d',GetoptLong::NO_ARGUMENT],
['--recreate', '-r',GetoptLong::NO_ARGUMENT],
['--force', '-f',GetoptLong::NO_ARGUMENT],
@ -64,6 +67,8 @@ opts = GetoptLong.new(
begin
opts.each do |opt, arg|
case opt
when '--migrate'
mode="-m"
when '--delete'
mode="-d"
when '--recreate'
@ -124,6 +129,8 @@ if vm_ids_array
vm.delete(true)
elsif mode == "-d"
vm.delete
elsif mode == "-m"
vm.resched
end
end
end