# File lib/virt/connection.rb, line 6
    def initialize uri, options = {}
      raise("Must provide a host to connect to") unless uri
      if uri =~ /^(esx|vpx)/
        raise("Must provide a username and password") unless options[:username] or options[:password]
        @connection = Libvirt::open_auth(uri, [Libvirt::CRED_AUTHNAME, Libvirt::CRED_PASSPHRASE]) do |cred|
          # This may only be required for ESXi connections, not sure.
          @type = "VMWare"
          case cred['type']
          when ::Libvirt::CRED_AUTHNAME
            options[:username]
          when ::Libvirt::CRED_PASSPHRASE
            options[:password]
          end
        end
      else
        @type = "KVM"
        @connection = Libvirt::open uri
      end
    end