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 connect_to_vsphere
          max_tries = global_config[:config]['max_tries'] || 3
          retry_factor = global_config[:config]['retry_factor'] || 10
          try = 1
          begin
            connection = RbVmomi::VIM.connect host: provider_config['server'],
                                              user: provider_config['username'],
                                              password: provider_config['password'],
                                              insecure: provider_config['insecure'] || false
            metrics.increment('connect.open')
            connection
          rescue StandardError => e
            metrics.increment('connect.fail')
            raise e if try >= max_tries
            sleep(try * retry_factor)
            try += 1
            retry
          end
        end
def connect_to_vsphere max_tries = global_config [ :config ] [ 'max_tries' ] || 3 retry_factor = global_config [ :config ] [ 'retry_factor' ] || 10 try = 1 begin connection = RbVmomi :: VIM . connect host : provider_config [ 'server' ] , user : provider_config [ 'username' ] , password : provider_config [ 'password' ] , insecure : provider_config [ 'insecure' ] || false metrics . increment ( 'connect.open' ) connection rescue StandardError => e metrics . increment ( 'connect.fail' ) raise e if try >= max_tries sleep ( try * retry_factor ) try += 1 retry end end
The connection_pool method is normally used only for testing
The connection_pool method is normally used only for testing