lib/vmpooler/providers/vsphere.rb
# The connection_pool method is normally used only for testing
The connection_pool method is normally used only for testing
The connection_pool method is normally used only for testing
def create_relocate_spec(target_datastore, target_datacenter_name, pool_name, connection)
          pool = pool_config(pool_name)
          target_cluster_name = get_target_cluster_from_config(pool_name)
          relocate_spec = RbVmomi::VIM.VirtualMachineRelocateSpec(
            datastore: find_datastore(target_datastore, connection, target_datacenter_name),
            diskMoveType: get_disk_backing(pool)
          )
          manage_host_selection = @config[:config]['manage_host_selection'] if @config[:config].key?('manage_host_selection')
          if manage_host_selection
            run_select_hosts(pool_name, @provider_hosts)
            target_host = select_next_host(pool_name, @provider_hosts)
            host_object = find_host_by_dnsname(connection, target_host)
            relocate_spec.host = host_object
          else
            target_cluster_object = find_cluster(target_cluster_name, connection, target_datacenter_name)
            relocate_spec.pool = target_cluster_object.resourcePool
          end
          relocate_spec
        end
def create_relocate_spec ( target_datastore , target_datacenter_name , pool_name , connection ) pool = pool_config ( pool_name ) target_cluster_name = get_target_cluster_from_config ( pool_name ) relocate_spec = RbVmomi :: VIM . VirtualMachineRelocateSpec ( datastore : find_datastore ( target_datastore , connection , target_datacenter_name ) , diskMoveType : get_disk_backing ( pool ) ) manage_host_selection = @config [ :config ] [ 'manage_host_selection' ] if @config [ :config ] . key? ( 'manage_host_selection' ) if manage_host_selection run_select_hosts ( pool_name , @provider_hosts ) target_host = select_next_host ( pool_name , @provider_hosts ) host_object = find_host_by_dnsname ( connection , target_host ) relocate_spec . host = host_object else target_cluster_object = find_cluster ( target_cluster_name , connection , target_datacenter_name ) relocate_spec . pool = target_cluster_object . resourcePool end relocate_spec end
The connection_pool method is normally used only for testing
The connection_pool method is normally used only for testing
# Choose a cluster/host to place the new VM on
target_datastore
target_datacenter_name
pool_name
connection