details: If we know the channel target name, pretty list it

This commit is contained in:
Cole Robinson 2013-10-05 14:04:49 -04:00
parent 0366589812
commit ff73f1119e
3 changed files with 20 additions and 3 deletions

View File

@ -266,7 +266,11 @@
<address type='virtio-serial' controller='1' bus='0' port='3'/>
</channel>
<channel type='pty'>
<target type='virtio' name='org.linux-kvm.port.0'/>
<target type='virtio' name='org.qemu.guest_agent.0'/>
</channel>
<channel type='unix'>
<source mode='bind'/>
<target type='virtio' name='org.libguestfs.channel.0'/>
</channel>

View File

@ -3511,9 +3511,12 @@ class vmmDetails(vmmGObjectUI):
port = chardev.target_port
label = devtype.capitalize()
if devtype not in ["console", "channel"]:
# Don't show port for console
if devtype in ["serial", "parallel"]:
label += " %s" % (int(port) + 1)
elif devtype == "channel":
name = chardev.pretty_channel_name(chardev.target_name)
if name:
label += " %s" % name
update_hwlist(HW_LIST_TYPE_CHAR, chardev, label,
"device_serial")

View File

@ -71,6 +71,16 @@ class _VirtualCharDevice(VirtualDevice):
CHANNEL_NAME_QEMUGA,
CHANNEL_NAME_LIBGUESTFS]
@staticmethod
def pretty_channel_name(val):
if val == _VirtualCharDevice.CHANNEL_NAME_SPICE:
return "spice"
if val == _VirtualCharDevice.CHANNEL_NAME_QEMUGA:
return "qemu-ga"
if val == _VirtualCharDevice.CHANNEL_NAME_LIBGUESTFS:
return "libguestfs"
return None
@staticmethod
def pretty_type(ctype):
"""