If a remote connection via GSSAPI fails with "no credentials cache found" let
virt-manager try to acquire a TGT via krb5-auth-dialog's DBus interface.

diff -r b587e1b6683c src/virtManager/connection.py
--- a/src/virtManager/connection.py	Fri Feb 13 14:50:42 2009 +0100
+++ b/src/virtManager/connection.py	Sat Feb 28 18:52:47 2009 +0100
@@ -233,6 +233,17 @@
                 self.emit("netdev-removed", dev.get_name())
                 del self.netdevs[name]
 
+    def _acquire_tgt(self):
+        try:
+            bus = dbus.SessionBus()
+            ka = bus.get_object('org.gnome.KrbAuthDialog',
+                                '/org/gnome/KrbAuthDialog')
+            ret = ka.acquireTgt("", dbus_interface='org.gnome.KrbAuthDialog')
+        except Exception, e:
+            logging.info("Cannot acquire tgt" + str(e))
+            ret = False
+        return ret
+
     def is_read_only(self):
         return self.readOnly
 
@@ -423,28 +434,40 @@
 
     def _open_thread(self):
         logging.debug("Background thread is running")
+        done = False
 
-        open_error = self._try_open()
+        while not done:
+            open_error = self._try_open()
+            done = True
 
-        if not open_error:
-            self.state = self.STATE_ACTIVE
-        else:
-            self.state = self.STATE_DISCONNECTED
+            if not open_error:
+                self.state = self.STATE_ACTIVE
+            else:
+                self.state = self.STATE_DISCONNECTED
 
-            if self.uri.find("+ssh://") > 0:
-                  hint = "\nMaybe you need to install ssh-askpass " + \
-                         "in order to authenticate."
-            else:
-                  hint = ""
+                if self.uri.find("+ssh://") > 0:
+                      hint = "\nMaybe you need to install ssh-askpass " + \
+                             "in order to authenticate."
+                else:
+                      hint = ""
 
-            (_type, value, stacktrace) = open_error
-            # Detailed error message, in English so it can be Googled.
-            self.connectError = \
-                    ("Unable to open connection to hypervisor URI '%s':\n" %
-                     str(self.uri)) + \
-                    str(_type) + " " + str(value) + "\n" + \
-                    traceback.format_exc (stacktrace) + hint
-            logging.error(self.connectError)
+                (_type, value, stacktrace) = open_error
+
+                if type(_type) == type(libvirt.libvirtError) and \
+                   value.get_error_code() == libvirt.VIR_ERR_AUTH_FAILED and \
+                   "GSSAPI Error" in value.get_error_message() and \
+                   "No credentials cache found" in value.get_error_message():
+                        if self._acquire_tgt():
+                            done = False
+                            continue
+
+                # Detailed error message, in English so it can be Googled.
+                self.connectError = \
+                        ("Unable to open connection to hypervisor URI '%s':\n" %
+                         str(self.uri)) + \
+                        str(_type) + " " + str(value) + "\n" + \
+                        traceback.format_exc (stacktrace) + hint
+                logging.error(self.connectError)
 
         # We want to kill off this thread asap, so schedule a gobject
         # idle even to inform the UI of result
