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]
|
[Unit]
|
||||||
Description=OpenNebula Node starter
|
Description=OpenNebula Node starter
|
||||||
After=opennebula.service opennebula-sunstone.service
|
After=opennebula.service opennebula-sunstone.service libvirt-bin.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
|
|
|
@ -73,9 +73,14 @@ def _do_resume(vm, wait)
|
||||||
if vm.status == "susp"
|
if vm.status == "susp"
|
||||||
puts("Resume on #{vm.name}")
|
puts("Resume on #{vm.name}")
|
||||||
vm.resume
|
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'
|
elsif vm.status == 'unkn'
|
||||||
puts("Boot on #{vm.name}")
|
puts("Resume on #{vm.name}")
|
||||||
vm.boot
|
vm.resume
|
||||||
else
|
else
|
||||||
return -1
|
return -1
|
||||||
end
|
end
|
||||||
|
@ -134,7 +139,7 @@ SUPPORTED = ['status', 'boot', 'resume', 'shutdown', 'suspend']
|
||||||
|
|
||||||
if not SUPPORTED.include?(options[:action])
|
if not SUPPORTED.include?(options[:action])
|
||||||
puts("Action : #{options[:action]}) is not supported")
|
puts("Action : #{options[:action]}) is not supported")
|
||||||
exit -1
|
exit(-1)
|
||||||
end
|
end
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
@ -143,7 +148,7 @@ begin
|
||||||
end
|
end
|
||||||
rescue
|
rescue
|
||||||
puts("#{options[:creds]}: Problem loading credentials, check if file exists.")
|
puts("#{options[:creds]}: Problem loading credentials, check if file exists.")
|
||||||
exit -1
|
exit(-1)
|
||||||
end
|
end
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
@ -154,7 +159,7 @@ begin
|
||||||
rc = vm_pool.info
|
rc = vm_pool.info
|
||||||
if OpenNebula.is_error?(rc)
|
if OpenNebula.is_error?(rc)
|
||||||
puts rc.message
|
puts rc.message
|
||||||
exit -1
|
exit(-1)
|
||||||
end
|
end
|
||||||
|
|
||||||
vm_pool.each do |vm|
|
vm_pool.each do |vm|
|
||||||
|
@ -162,6 +167,7 @@ begin
|
||||||
when "status"
|
when "status"
|
||||||
puts("#{vm.name}\t#{vm.status}")
|
puts("#{vm.name}\t#{vm.status}")
|
||||||
when "boot"
|
when "boot"
|
||||||
|
puts("DEBUG #{vm.status}")
|
||||||
if vm.status == "unkn"
|
if vm.status == "unkn"
|
||||||
puts("Booting #{vm.name} ...")
|
puts("Booting #{vm.name} ...")
|
||||||
vm.boot
|
vm.boot
|
||||||
|
@ -176,6 +182,6 @@ begin
|
||||||
end
|
end
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
puts e.message
|
puts e.message
|
||||||
exit -1
|
exit(-1)
|
||||||
end
|
end
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in New Issue