mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 01:58:41 -05:00
Remove VM from completed only after destroy
This commit updates destroy_vm to remove the redis member from the completed queue only after a destroy has been completed. Without this change a VM that is being destroyed will be logged as discovered when inventory is checked since it has already been removed from the completed queue.
This commit is contained in:
parent
10efddd43e
commit
90edc6f979
2 changed files with 3 additions and 1 deletions
|
|
@ -16,6 +16,7 @@ git logs & PR history.
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- (POOLER-128) VM specific mutex objects are not dereferenced when a VM is destroyed
|
- (POOLER-128) VM specific mutex objects are not dereferenced when a VM is destroyed
|
||||||
|
- A VM that is being destroyed is reported as discovered
|
||||||
|
|
||||||
# [0.1.0](https://github.com/puppetlabs/vmpooler/compare/4c858d012a262093383e57ea6db790521886d8d4...master)
|
# [0.1.0](https://github.com/puppetlabs/vmpooler/compare/4c858d012a262093383e57ea6db790521886d8d4...master)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -298,7 +298,6 @@ module Vmpooler
|
||||||
mutex = vm_mutex(vm)
|
mutex = vm_mutex(vm)
|
||||||
return if mutex.locked?
|
return if mutex.locked?
|
||||||
mutex.synchronize do
|
mutex.synchronize do
|
||||||
$redis.srem('vmpooler__completed__' + pool, vm)
|
|
||||||
$redis.hdel('vmpooler__active__' + pool, vm)
|
$redis.hdel('vmpooler__active__' + pool, vm)
|
||||||
$redis.hset('vmpooler__vm__' + vm, 'destroy', Time.now)
|
$redis.hset('vmpooler__vm__' + vm, 'destroy', Time.now)
|
||||||
|
|
||||||
|
|
@ -309,6 +308,8 @@ module Vmpooler
|
||||||
|
|
||||||
provider.destroy_vm(pool, vm)
|
provider.destroy_vm(pool, vm)
|
||||||
|
|
||||||
|
$redis.srem('vmpooler__completed__' + pool, vm)
|
||||||
|
|
||||||
finish = format('%.2f', Time.now - start)
|
finish = format('%.2f', Time.now - start)
|
||||||
$logger.log('s', "[-] [#{pool}] '#{vm}' destroyed in #{finish} seconds")
|
$logger.log('s', "[-] [#{pool}] '#{vm}' destroyed in #{finish} seconds")
|
||||||
$metrics.timing("destroy.#{pool}", finish)
|
$metrics.timing("destroy.#{pool}", finish)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue