mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 01:58:41 -05:00
More pooler queue logic
This commit is contained in:
parent
4faabb9842
commit
4534310d94
1 changed files with 17 additions and 13 deletions
|
|
@ -69,27 +69,31 @@ 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)
|
begin
|
||||||
if (vsphere_helper.find_vms(vm)[vm].summary.guest.hostName == vm)
|
Socket.getaddrinfo(vm, nil)
|
||||||
begin
|
rescue
|
||||||
Socket.getaddrinfo(vm, nil)
|
if (
|
||||||
rescue
|
(vsphere_helper.find_vms(vm)[vm].runtime) and
|
||||||
next
|
(vsphere_helper.find_vms(vm)[vm].runtime.bootTime) and
|
||||||
end
|
(((( Time.now - vsphere_helper.find_mvs(vm)[vm].runtime.bootTime ) / 60 ) / 60 ) >= 1)
|
||||||
|
)
|
||||||
$redis.sadd('vmware_host_pool__ready__'+pool['name'], vm)
|
|
||||||
$redis.srem('vmware_host_pool__pending__'+pool['name'], vm)
|
|
||||||
|
|
||||||
logger.log('s', "[>] '#{vm}' moved to 'ready' queue")
|
|
||||||
else
|
|
||||||
$redis.srem('vmware_host_pool__pending__'+pool['name'], vm)
|
$redis.srem('vmware_host_pool__pending__'+pool['name'], vm)
|
||||||
$redis.sadd('vmware_host_pool__failed__'+pool['name'], vm)
|
$redis.sadd('vmware_host_pool__failed__'+pool['name'], vm)
|
||||||
|
|
||||||
logger.log('s', "[<] '#{vm}' moved to 'failed' queue")
|
logger.log('s', "[<] '#{vm}' moved to 'failed' queue")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
|
$redis.sadd('vmware_host_pool__ready__'+pool['name'], vm)
|
||||||
|
$redis.srem('vmware_host_pool__pending__'+pool['name'], vm)
|
||||||
|
|
||||||
|
logger.log('s', "[>] '#{vm}' moved to 'ready' queue")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue