lib/vmpooler/providers/vsphere.rb
def run_select_hosts(pool_name, target)
          now = Time.now
          max_age = @config[:config]['host_selection_max_age'] || 60
          loop_delay = 5
          datacenter = get_target_datacenter_from_config(pool_name)
          cluster = get_target_cluster_from_config(pool_name)
          raise("cluster for pool #{pool_name} cannot be identified") if cluster.nil?
          raise("datacenter for pool #{pool_name} cannot be identified") if datacenter.nil?

          dc = "#{datacenter}_#{cluster}"
          unless target.key?(dc)
            select_target_hosts(target, cluster, datacenter)
            return
          end
          wait_for_host_selection(dc, target, loop_delay, max_age) if target[dc].key?('checking')
          select_target_hosts(target, cluster, datacenter) if target[dc].key?('check_time_finished') && now - target[dc]['check_time_finished'] > max_age
        end
# 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 run_select_hosts(pool_name, target)
          now = Time.now
          max_age = @config[:config]['host_selection_max_age'] || 60
          loop_delay = 5
          datacenter = get_target_datacenter_from_config(pool_name)
          cluster = get_target_cluster_from_config(pool_name)
          raise("cluster for pool #{pool_name} cannot be identified") if cluster.nil?
          raise("datacenter for pool #{pool_name} cannot be identified") if datacenter.nil?
          dc = "#{datacenter}_#{cluster}"
          unless target.key?(dc)
            select_target_hosts(target, cluster, datacenter)
            return
          end
          wait_for_host_selection(dc, target, loop_delay, max_age) if target[dc].key?('checking')
          select_target_hosts(target, cluster, datacenter) if target[dc].key?('check_time_finished') && now - target[dc]['check_time_finished'] > max_age
        end
def run_select_hosts ( pool_name , target ) now = Time . now max_age = @config [ :config ] [ 'host_selection_max_age' ] || 60 loop_delay = 5 datacenter = get_target_datacenter_from_config ( pool_name ) cluster = get_target_cluster_from_config ( pool_name ) raise ( "cluster for pool #{pool_name} cannot be identified" ) if cluster . nil? raise ( "datacenter for pool #{pool_name} cannot be identified" ) if datacenter . nil? dc = "#{datacenter}_#{cluster}" unless target . key? ( dc ) select_target_hosts ( target , cluster , datacenter ) return end wait_for_host_selection ( dc , target , loop_delay , max_age ) if target [ dc ] . key? ( 'checking' ) select_target_hosts ( target , cluster , datacenter ) if target [ dc ] . key? ( 'check_time_finished' ) && now - target [ dc ] [ 'check_time_finished' ] > max_age end
The connection_pool method is normally used only for testing
The connection_pool method is normally used only for testing
pool_name
target