From 7b9b1788617a8e0b3ca5bd43befbc18c47601904 Mon Sep 17 00:00:00 2001 From: Colin Date: Fri, 2 Oct 2015 13:02:38 -0700 Subject: [PATCH] (MAINT) Remove Ping Check on Running VMs Prior to this commit, a running VM could fail a ping check and be destroyed. This causes issues when network hiccups occur or the machine is performing a reboot. A VM that is in a ready state will now be destroyed when handed back or it hits the lifetime TTL. --- lib/vmpooler/pool_manager.rb | 6 ------ spec/vmpooler/pool_manager_spec.rb | 6 +++--- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/vmpooler/pool_manager.rb b/lib/vmpooler/pool_manager.rb index cb9e99c..7cb1af6 100644 --- a/lib/vmpooler/pool_manager.rb +++ b/lib/vmpooler/pool_manager.rb @@ -149,12 +149,6 @@ module Vmpooler if host queue_from, queue_to = 'running', 'completed' - # Check that VM is powered on - if (host.runtime) && - (host.runtime.powerState != 'poweredOn') - move_vm_queue(pool, vm, queue_from, queue_to, 'appears to be powered off or dead') - end - # Check that VM is within defined lifetime checkouttime = $redis.hget('vmpooler__active__' + pool, vm) if checkouttime diff --git a/spec/vmpooler/pool_manager_spec.rb b/spec/vmpooler/pool_manager_spec.rb index 49ee29b..a402bf4 100644 --- a/spec/vmpooler/pool_manager_spec.rb +++ b/spec/vmpooler/pool_manager_spec.rb @@ -168,14 +168,14 @@ describe 'Pool Manager' do context 'valid host' do let(:vm_host) { double('vmhost') } - it 'moves vm when not poweredOn' do + it 'does not move vm when not poweredOn' do allow(pool_helper).to receive(:find_vm).and_return vm_host allow(vm_host).to receive(:runtime).and_return true allow(vm_host).to receive_message_chain(:runtime, :powerState).and_return 'poweredOff' expect(redis).to receive(:hget) - expect(redis).to receive(:smove) - expect(logger).to receive(:log).with('d', "[!] [#{pool}] '#{vm}' appears to be powered off or dead") + expect(redis).not_to receive(:smove) + expect(logger).not_to receive(:log).with('d', "[!] [#{pool}] '#{vm}' appears to be powered off or dead") subject._check_running_vm(vm, pool, timeout) end