More pooler queue logic

This commit is contained in:
Scott Schneider 2013-10-10 15:00:52 -07:00
parent 4faabb9842
commit 4534310d94

View file

@ -69,13 +69,24 @@ loop do
if ( if (
(vsphere_helper.find_vms(vm)[vm]) and (vsphere_helper.find_vms(vm)[vm]) and
(vsphere_helper.find_vms(vm)[vm].summary.guest.toolsRunningStatus == 'guestToolsRunning') and (vsphere_helper.find_vms(vm)[vm].summary.guest.toolsRunningStatus == 'guestToolsRunning') and
(vsphere_helper.find_vms(vm)[vm].summary.guest.hostName) and
(vsphere_helper.find_vms(vm)[vm].summary.guest.hostName == vm) and
(vsphere_helper.find_vms(vm)[vm].summary.guest.ipAddress != nil) (vsphere_helper.find_vms(vm)[vm].summary.guest.ipAddress != nil)
) )
if (vsphere_helper.find_vms(vm)[vm].summary.guest.hostName)
if (vsphere_helper.find_vms(vm)[vm].summary.guest.hostName == vm)
begin begin
Socket.getaddrinfo(vm, nil) Socket.getaddrinfo(vm, nil)
rescue rescue
if (
(vsphere_helper.find_vms(vm)[vm].runtime) and
(vsphere_helper.find_vms(vm)[vm].runtime.bootTime) and
(((( Time.now - vsphere_helper.find_mvs(vm)[vm].runtime.bootTime ) / 60 ) / 60 ) >= 1)
)
$redis.srem('vmware_host_pool__pending__'+pool['name'], vm)
$redis.sadd('vmware_host_pool__failed__'+pool['name'], vm)
logger.log('s', "[<] '#{vm}' moved to 'failed' queue")
end
next next
end end
@ -83,13 +94,6 @@ loop do
$redis.srem('vmware_host_pool__pending__'+pool['name'], vm) $redis.srem('vmware_host_pool__pending__'+pool['name'], vm)
logger.log('s', "[>] '#{vm}' moved to 'ready' queue") logger.log('s', "[>] '#{vm}' moved to 'ready' queue")
else
$redis.srem('vmware_host_pool__pending__'+pool['name'], vm)
$redis.sadd('vmware_host_pool__failed__'+pool['name'], vm)
logger.log('s', "[<] '#{vm}' moved to 'failed' queue")
end
end
end end
end end