mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 01:58:41 -05:00
destroy_vm should clear out Redis queue
This commit is contained in:
parent
e1cf8d16a6
commit
aea6e32e3d
1 changed files with 11 additions and 3 deletions
|
|
@ -136,7 +136,7 @@ def check_vm vm, pool
|
|||
end
|
||||
|
||||
# Destroy a VM
|
||||
def destroy_vm vm
|
||||
def destroy_vm vm, pool
|
||||
Thread.new {
|
||||
host = $vsphere_helper.find_vms(vm)[vm]
|
||||
|
||||
|
|
@ -154,6 +154,8 @@ def destroy_vm vm
|
|||
host.Destroy_Task.wait_for_completion
|
||||
finish = '%.2f' % (Time.now-start)
|
||||
|
||||
$redis.srem('vmware_host_pool__completed__'+pool, vm)
|
||||
|
||||
$logger.log('s', "[-] '#{vm}' destroyed in #{finish} seconds")
|
||||
end
|
||||
}
|
||||
|
|
@ -234,7 +236,10 @@ loop do
|
|||
end
|
||||
|
||||
Thread.new {
|
||||
destroy_vm(vm)
|
||||
destroy_vm(
|
||||
vm,
|
||||
pool['name']
|
||||
)
|
||||
}
|
||||
end
|
||||
}
|
||||
|
|
@ -331,7 +336,10 @@ loop do
|
|||
$logger.log('s', "[>] '#{vm}' moved to 'ready' queue")
|
||||
else
|
||||
Thread.new {
|
||||
destroy_vm(vm)
|
||||
destroy_vm(
|
||||
vm,
|
||||
pool['name']
|
||||
)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue