From 5b6985c3a7f01abf02b4d18a1003f8995c5dbd36 Mon Sep 17 00:00:00 2001 From: Scott Schneider Date: Thu, 17 Sep 2015 11:11:12 -0700 Subject: [PATCH] (QENG-2952) Check that SSH is available SSH should be available before a VM is moved from the 'pending' queue to 'ready'. `check_ssh` should probably be a function in the tradition of DRY; I'm going to hopefully follow up this PR with a `Vmpooler::Utility` library. --- lib/vmpooler/pool_manager.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/vmpooler/pool_manager.rb b/lib/vmpooler/pool_manager.rb index 8c1fcc3..79ef64a 100644 --- a/lib/vmpooler/pool_manager.rb +++ b/lib/vmpooler/pool_manager.rb @@ -31,6 +31,14 @@ module Vmpooler host = $vsphere[pool].find_vm(vm) if host + begin + Timeout.timeout(5) do + TCPSocket.new vm, 22 + end + rescue + fail_pending_vm(vm, pool, timeout) + end + move_pending_vm_to_ready(vm, pool, host) else fail_pending_vm(vm, pool, timeout)