From cd46eea13e3573d3122b0a55bbe1833cd4c48a23 Mon Sep 17 00:00:00 2001 From: "kirby@puppetlabs.com" Date: Fri, 13 Oct 2017 18:02:26 -0700 Subject: [PATCH] Only specify cluster for clone operations This commit updates create_vm to target a cluster instead of an individual host for clone operations. Without this change cluster host utilization needs to be inspected for everyone clone operation. --- lib/vmpooler/providers/vsphere.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/vmpooler/providers/vsphere.rb b/lib/vmpooler/providers/vsphere.rb index f3d9e70..fc941ba 100644 --- a/lib/vmpooler/providers/vsphere.rb +++ b/lib/vmpooler/providers/vsphere.rb @@ -171,12 +171,12 @@ module Vmpooler ) # Choose a cluster/host to place the new VM on - target_host_object = find_least_used_host(target_cluster_name, connection, target_datacenter_name) + target_cluster_object = find_cluster(target_cluster_name, connection, target_datacenter_name) # Put the VM in the specified folder and resource pool relocate_spec = RbVmomi::VIM.VirtualMachineRelocateSpec( datastore: find_datastore(target_datastore, connection, target_datacenter_name), - host: target_host_object, + pool: target_cluster_object.resourcePool, diskMoveType: :moveChildMostDiskBacking )