[PATCH] Make UI show qemu:///{session, system} differently

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Here's the first of a few patches, I've been neglecting to forward to
you guys.

Right now, there's no way to tell the difference between qemu:///system
and qemu:///session. This patch makes it obvious in the UI which of the
two you're connected to.

The patch is against 0.5.3.

-- 
Soren Hansen               | 
Virtualisation specialist  | Ubuntu Server Team
Canonical Ltd.             | http://www.ubuntu.com/
Index: virt-manager-0.5.3/src/virtManager/connection.py
===================================================================
--- virt-manager-0.5.3.orig/src/virtManager/connection.py	2008-02-23 21:06:29.134918324 +0100
+++ virt-manager-0.5.3/src/virtManager/connection.py	2008-02-23 21:07:05.885922981 +0100
@@ -223,8 +223,33 @@
         offset = hostname.find(".")
         if offset > 0 and not hostname[0].isdigit():
             return hostname[0:offset]
+        if self.get_driver() == 'qemu' and hostname == 'localhost':
+            if self.get_path() != '':
+                if self.get_path() == '/system':
+                    path = 'System'
+                elif self.get_path() == '/session':
+                    path = 'User'
+                else:
+                    path = self.get_path[1:]
+            elif sys.getuid() == 0:
+                path = 'system'
+            else:
+                path = 'session'
+                
+            return '%s (%s)' % (hostname, path)
         return hostname
 
+    def get_path(self):
+        try:
+            (scheme, username, netloc, path, query, fragment) = uri_split(self.uri)
+
+            if path != "":
+                return path
+        except Exception, e:
+            logging.warning("Cannot parse URI %s: %s" % (self.uri, str(e)))
+
+        return ""
+
     def get_hostname(self, resolveLocal=False):
         try:
             (scheme, username, netloc, path, query, fragment) = uri_split(self.uri)

Attachment: signature.asc
Description: Digital signature

_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux