Mise à jour du script onevm-all pour qu'il fonctionne avec one 5.0.2
Les actions ont changés sur cette version, "resume" résoud tout :) Le service doit également démarrer après libvirt et s'arrêter avant.
This commit is contained in:
parent
f8bdbe1128
commit
8ef200b6b2
@ -1,6 +1,6 @@
|
||||
[Unit]
|
||||
Description=OpenNebula Node starter
|
||||
After=opennebula.service opennebula-sunstone.service
|
||||
After=opennebula.service opennebula-sunstone.service libvirt-bin.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
|
@ -27,7 +27,7 @@ INTERVAL=1
|
||||
|
||||
def _wait(vm, st)
|
||||
wait = 0
|
||||
while vm.status != st
|
||||
while vm.status != st
|
||||
vm.info
|
||||
if vm.status == 'unkn'
|
||||
break
|
||||
@ -73,9 +73,14 @@ def _do_resume(vm, wait)
|
||||
if vm.status == "susp"
|
||||
puts("Resume on #{vm.name}")
|
||||
vm.resume
|
||||
# elsif vm.status == 'save'
|
||||
# puts("Recover on #{vm.name}")
|
||||
# # Try to recover VM with retry action
|
||||
# vm.recover(2)
|
||||
# vm.resume
|
||||
elsif vm.status == 'unkn'
|
||||
puts("Boot on #{vm.name}")
|
||||
vm.boot
|
||||
puts("Resume on #{vm.name}")
|
||||
vm.resume
|
||||
else
|
||||
return -1
|
||||
end
|
||||
@ -134,7 +139,7 @@ SUPPORTED = ['status', 'boot', 'resume', 'shutdown', 'suspend']
|
||||
|
||||
if not SUPPORTED.include?(options[:action])
|
||||
puts("Action : #{options[:action]}) is not supported")
|
||||
exit -1
|
||||
exit(-1)
|
||||
end
|
||||
|
||||
begin
|
||||
@ -143,7 +148,7 @@ begin
|
||||
end
|
||||
rescue
|
||||
puts("#{options[:creds]}: Problem loading credentials, check if file exists.")
|
||||
exit -1
|
||||
exit(-1)
|
||||
end
|
||||
|
||||
begin
|
||||
@ -154,7 +159,7 @@ begin
|
||||
rc = vm_pool.info
|
||||
if OpenNebula.is_error?(rc)
|
||||
puts rc.message
|
||||
exit -1
|
||||
exit(-1)
|
||||
end
|
||||
|
||||
vm_pool.each do |vm|
|
||||
@ -162,6 +167,7 @@ begin
|
||||
when "status"
|
||||
puts("#{vm.name}\t#{vm.status}")
|
||||
when "boot"
|
||||
puts("DEBUG #{vm.status}")
|
||||
if vm.status == "unkn"
|
||||
puts("Booting #{vm.name} ...")
|
||||
vm.boot
|
||||
@ -176,6 +182,6 @@ begin
|
||||
end
|
||||
rescue Exception => e
|
||||
puts e.message
|
||||
exit -1
|
||||
exit(-1)
|
||||
end
|
||||
exit 0
|
||||
|
Loading…
Reference in New Issue
Block a user