addhw: add CharDevice.source_channel
This property maps to channel/source/@channel domain XML.
This commit is contained in:
parent
2606c1d1b8
commit
5882f05e3e
|
@ -44,5 +44,9 @@
|
|||
<source mode="bind" path="/tmp/foobar"/>
|
||||
<target type="guestfwd" address="1.2.3.4" port="4567"/>
|
||||
</channel>
|
||||
<channel type="spiceport">
|
||||
<source channel="org.spice-space.webdav.0"/>
|
||||
<target type="virtio" name="org.spice-space.webdav.0"/>
|
||||
</channel>
|
||||
</devices>
|
||||
</domain>
|
||||
|
|
|
@ -47,5 +47,9 @@
|
|||
<source mode="bind" path="/tmp/foobar"/>
|
||||
<target type="guestfwd" address="5.6.7.8" port="1199"/>
|
||||
</channel>
|
||||
<channel type="spiceport">
|
||||
<source channel="test.1"/>
|
||||
<target type="virtio" name="test.2"/>
|
||||
</channel>
|
||||
</devices>
|
||||
</domain>
|
||||
|
|
|
@ -361,6 +361,7 @@ class XMLParseTest(unittest.TestCase):
|
|||
console2 = guest.get_devices("console")[1]
|
||||
channel1 = guest.get_devices("channel")[0]
|
||||
channel2 = guest.get_devices("channel")[1]
|
||||
channel3 = guest.get_devices("channel")[2]
|
||||
|
||||
check = self._make_checker(serial1)
|
||||
check("type", "null", "udp")
|
||||
|
@ -408,6 +409,12 @@ class XMLParseTest(unittest.TestCase):
|
|||
check("target_address", "1.2.3.4", "5.6.7.8")
|
||||
check("target_port", 4567, 1199)
|
||||
|
||||
check = self._make_checker(channel3)
|
||||
check("type", "spiceport")
|
||||
check("source_channel", "org.spice-space.webdav.0", "test.1")
|
||||
check("target_type", "virtio")
|
||||
check("target_name", "org.spice-space.webdav.0", "test.2")
|
||||
|
||||
self._alter_compare(guest.get_xml_config(), outfile)
|
||||
|
||||
def testAlterControllers(self):
|
||||
|
|
|
@ -170,7 +170,7 @@ class _VirtualCharDevice(VirtualDevice):
|
|||
|
||||
_XML_PROP_ORDER = ["type", "_has_mode_bind", "_has_mode_connect",
|
||||
"bind_host", "bind_port",
|
||||
"source_mode", "_source_path",
|
||||
"source_mode", "_source_path", "source_channel",
|
||||
"source_host", "source_port",
|
||||
"target_type", "target_name"]
|
||||
|
||||
|
@ -191,6 +191,9 @@ class _VirtualCharDevice(VirtualDevice):
|
|||
self._source_path = val
|
||||
source_path = property(_get_source_path, _set_source_path)
|
||||
|
||||
source_channel = XMLProperty(xpath="./source/@channel",
|
||||
doc=_("Source channel name."))
|
||||
|
||||
def _get_default_source_mode(self):
|
||||
if self.type == self.TYPE_UDP:
|
||||
return self.MODE_CONNECT
|
||||
|
|
Loading…
Reference in New Issue