mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-01-06 13:17:58 +03:00
9d78759ac5
redirdev does the same internally for libvirt, so let's follow that pattern, and fix the fallout
39 lines
907 B
Python
39 lines
907 B
Python
#
|
|
# Copyright 2011, 2013 Red Hat, Inc.
|
|
#
|
|
# This work is licensed under the GNU GPLv2 or later.
|
|
# See the COPYING file in the top-level directory.
|
|
|
|
from .char import CharSource
|
|
from .device import Device
|
|
from ..xmlbuilder import XMLChildProperty, XMLProperty
|
|
|
|
|
|
class DeviceRedirdev(Device):
|
|
XML_NAME = "redirdev"
|
|
|
|
@staticmethod
|
|
def pretty_type(typ):
|
|
if typ == "tcp":
|
|
return "TCP"
|
|
if typ == "spicevmc":
|
|
return "SpiceVMC"
|
|
return typ and typ.capitalize()
|
|
|
|
_XML_PROP_ORDER = ["bus", "type", "source"]
|
|
|
|
bus = XMLProperty("./@bus")
|
|
type = XMLProperty("./@type")
|
|
source = XMLChildProperty(CharSource, is_single=True)
|
|
|
|
|
|
##################
|
|
# Default config #
|
|
##################
|
|
|
|
def set_defaults(self, guest):
|
|
if not self.bus:
|
|
self.bus = "usb"
|
|
if not self.type:
|
|
self.type = "spicevmc"
|