From d9e9d2e81cdc2fec92454c1331665d9873b49499 Mon Sep 17 00:00:00 2001 From: Daniel Dehennin Date: Wed, 7 Jun 2017 08:59:09 +0200 Subject: [PATCH] Resume only VMs running before the reboot If a user suspend a VM manually, onenode.service must not resume it automatically. * scripts/onevm-all: Check if suspended VMs are in the saved list of running VMs. Ref: #20718 --- scripts/onevm-all | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/onevm-all b/scripts/onevm-all index af7fbd8..e6d7e27 100755 --- a/scripts/onevm-all +++ b/scripts/onevm-all @@ -181,7 +181,7 @@ begin vm_pool = VirtualMachinePool.new(client, USERFLAG) if File.exist?(RUNVMFILE) - running_vms = File.open(RUNVMFILE,'r') + running_vms = File.readlines(RUNVMFILE) else running_vms = [] end @@ -211,11 +211,9 @@ begin when "suspend" _do_suspend(vm, options[:wait]) when "resume" - force = FALSE - if running_vms.include?('vm.id') - force = TRUE + if running_vms.include?("#{vm.id}\n") + _do_resume(vm, options[:wait], TRUE) end - _do_resume(vm, options[:wait], force) else puts("#{vm.name}\t#{vm.status}") end