# File lib/vagrant-libvirt/provider.rb, line 41
      def ssh_info
        # Return the ssh_info if already retrieved otherwise call the driver
        # and save the result.
        #
        # Ssh info has following format..
        #
        # {
        #  :host => "1.2.3.4",
        #  :port => "22",
        #  :username => "mitchellh",
        #  :private_key_path => "/path/to/my/key"
        # }
        # note that modifing @machine.id or accessing @machine.state is not
        # thread safe, so be careful to avoid these here as this method may
        # be called from other threads of execution.
        return nil if state.id != :running

        ip = driver.get_ipaddress(@machine)

        # if can't determine the IP, just return nil and let the core
        # deal with it, similar to the docker provider
        return nil unless ip

        ssh_info = {
          host: ip,
          port: @machine.config.ssh.guest_port,
          forward_agent: @machine.config.ssh.forward_agent,
          forward_x11: @machine.config.ssh.forward_x11
        }

        if @machine.provider_config.connect_via_ssh
          ssh_info[:proxy_command] =
            "ssh '#{@machine.provider_config.host}' " \
            "-l '#{@machine.provider_config.username}' " \
            "-i '#{@machine.provider_config.id_ssh_key_file}' " \
            'nc %h %p'

        end

        ssh_info
      end