mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 01:58:41 -05:00
Rework vCenter VM retrieval method
Previous, the propertyCollector method was used to find VMs within vCenter. This method was ineffecient, as it would retrieve a list of the entire vCenter inventory and then parse for the specified VM. This has been replaced with a fetch via searchIndex.FindByDnsName, which returns only the requested VM object.
This commit is contained in:
parent
ba3831bffb
commit
bbe67ab8a3
2 changed files with 34 additions and 57 deletions
|
|
@ -45,7 +45,7 @@ $threads = {}
|
|||
# Check the state of a VM
|
||||
def check_pending_vm vm, pool, timeout
|
||||
Thread.new {
|
||||
host = $vsphere[pool].find_vms(vm)[vm]
|
||||
host = $vsphere[pool].find_vm(vm)
|
||||
|
||||
if (host)
|
||||
if (
|
||||
|
|
@ -79,7 +79,7 @@ end
|
|||
|
||||
def check_ready_vm vm, pool, ttl
|
||||
Thread.new {
|
||||
host = $vsphere[pool].find_vms(vm)[vm]
|
||||
host = $vsphere[pool].find_vm(vm)
|
||||
|
||||
if (host)
|
||||
if (
|
||||
|
|
@ -107,7 +107,7 @@ end
|
|||
|
||||
def check_running_vm vm, pool, ttl
|
||||
Thread.new {
|
||||
host = $vsphere[pool].find_vms(vm)[vm]
|
||||
host = $vsphere[pool].find_vm(vm)
|
||||
|
||||
if (host)
|
||||
if (
|
||||
|
|
@ -214,7 +214,7 @@ def destroy_vm vm, pool
|
|||
$redis.srem('vmware_host_pool__completed__'+pool, vm)
|
||||
$redis.hdel('vmware_host_pool__active__'+pool, vm)
|
||||
|
||||
host = $vsphere[pool].find_vms(vm)[vm]
|
||||
host = $vsphere[pool].find_vm(vm)
|
||||
|
||||
if (host)
|
||||
start = Time.now
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue