diff --git a/lib/vmpooler/pool_manager.rb b/lib/vmpooler/pool_manager.rb index 20231ef3d..939d7bc54 100644 --- a/lib/vmpooler/pool_manager.rb +++ b/lib/vmpooler/pool_manager.rb @@ -35,11 +35,8 @@ def open_socket(host, domain=nil, timeout=5, port=22, &block) yield sock if block_given? ensure sock.close - return true end end - rescue SocketError - rescue Timeout::Error end def _check_pending_vm(vm, pool, timeout, vsphere) @@ -49,8 +46,7 @@ def _check_pending_vm(vm, pool, timeout, vsphere) fail_pending_vm(vm, pool, timeout, false) return end - socket = open_socket vm - fail_pending_vm(vm, pool, timeout) if ! socket + open_socket vm move_pending_vm_to_ready(vm, pool, host) rescue fail_pending_vm(vm, pool, timeout) @@ -145,8 +141,9 @@ def check_ready_vm(vm, pool, ttl, vsphere) $logger.log('s', "[!] [#{pool}] '#{vm}' not found in vCenter inventory, removed from 'ready' queue") end - socket = open_socket vm - if ! socket + begin + open_socket vm + rescue if $redis.smove('vmpooler__ready__' + pool, 'vmpooler__completed__' + pool, vm) $logger.log('d', "[!] [#{pool}] '#{vm}' is unreachable, removed from 'ready' queue") else