mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 10:08:40 -05:00
Merge pull request #13 from sschneid/hostname_check
Add a check to 'check_ready_vm' to make sure hostname still matches
This commit is contained in:
commit
648286ec37
1 changed files with 12 additions and 1 deletions
|
|
@ -103,7 +103,8 @@ def check_ready_vm vm, pool, ttl
|
||||||
)
|
)
|
||||||
$redis.hset('vmware_host_pool__vm__'+vm, 'check', Time.now)
|
$redis.hset('vmware_host_pool__vm__'+vm, 'check', Time.now)
|
||||||
|
|
||||||
host = $vsphere[pool].find_vm(vm)
|
host = $vsphere[pool].find_vm(vm) ||
|
||||||
|
$vsphere[pool].find_vm_heavy(vm)[vm]
|
||||||
|
|
||||||
if (host)
|
if (host)
|
||||||
if (
|
if (
|
||||||
|
|
@ -115,6 +116,16 @@ def check_ready_vm vm, pool, ttl
|
||||||
|
|
||||||
$logger.log('d', "[!] [#{pool}] '#{vm}' appears to be powered off, removed from 'ready' queue")
|
$logger.log('d', "[!] [#{pool}] '#{vm}' appears to be powered off, removed from 'ready' queue")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if (
|
||||||
|
(host.summary.guest) and
|
||||||
|
(host.summary.guest.hostName) and
|
||||||
|
(host.summary.guest.hostName != vm)
|
||||||
|
)
|
||||||
|
$redis.smove('vmware_host_pool__ready__'+pool, 'vmware_host_pool__completed__'+pool, vm)
|
||||||
|
|
||||||
|
$logger.log('d', "[!] [#{pool}] '#{vm}' has mismatched hostname, removed from 'ready' queue")
|
||||||
|
end
|
||||||
else
|
else
|
||||||
$redis.srem('vmware_host_pool__ready__'+pool, vm)
|
$redis.srem('vmware_host_pool__ready__'+pool, vm)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue