diff --git a/init/onenode.service b/init/onenode.service index 44e3964..c910a83 100644 --- a/init/onenode.service +++ b/init/onenode.service @@ -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 diff --git a/scripts/onevm-all b/scripts/onevm-all index 90fddab..b6a73f2 100755 --- a/scripts/onevm-all +++ b/scripts/onevm-all @@ -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