mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
Add 'pretty string' routine that doesn't require the conn to be active.
This commit is contained in:
parent
6628d6ea48
commit
5d02a09016
@ -215,24 +215,39 @@ class vmmConnection(gobject.GObject):
|
||||
return True
|
||||
return False
|
||||
|
||||
def get_pretty_desc(self):
|
||||
def _get_pretty_desc(self):
|
||||
(scheme, ignore, hostname,
|
||||
path, ignore, ignore) = virtinst.util.uri_split(self.uri)
|
||||
|
||||
hv = ""
|
||||
rest = ""
|
||||
scheme = scheme.split("+")[0]
|
||||
|
||||
if scheme == "qemu":
|
||||
desc = "QEMU"
|
||||
if self.is_kvm_supported():
|
||||
desc += "/KVM"
|
||||
hv = "QEMU"
|
||||
else:
|
||||
desc = scheme.capitalize()
|
||||
hv = scheme.capitalize()
|
||||
|
||||
if path == "/session":
|
||||
desc += " Usermode"
|
||||
if path and path != "/system":
|
||||
if path == "/session":
|
||||
rest += " Usermode"
|
||||
else:
|
||||
rest += " %s" % os.path.basename(path)
|
||||
if hostname:
|
||||
desc += " (%s)" % hostname
|
||||
return desc
|
||||
rest += " (%s)" % hostname.split(".")[0]
|
||||
|
||||
return hv, rest
|
||||
|
||||
def get_pretty_desc_inactive(self):
|
||||
hv, rest = self._get_pretty_desc()
|
||||
return hv + rest
|
||||
|
||||
def get_pretty_desc_active(self):
|
||||
hv, rest = self._get_pretty_desc()
|
||||
|
||||
if self.is_kvm_supported():
|
||||
hv += "/KVM"
|
||||
return hv + rest
|
||||
|
||||
def get_uri(self):
|
||||
return self.uri
|
||||
|
@ -547,7 +547,7 @@ class vmmCreate(gobject.GObject):
|
||||
# Favor local connections over remote connections
|
||||
default = len(model)
|
||||
|
||||
model.append([connobj.get_uri(), connobj.get_pretty_desc()])
|
||||
model.append([connobj.get_uri(), connobj.get_pretty_desc_active()])
|
||||
|
||||
no_conns = (len(model) == 0)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user