diff --git a/tests/testdriver.xml b/tests/testdriver.xml
index 580ceb3b6..ceb27a47b 100644
--- a/tests/testdriver.xml
+++ b/tests/testdriver.xml
@@ -483,6 +483,9 @@ Foo bar baz & yeah boii < > yeahfoo
+
+
+
diff --git a/tests/xmlparse-xml/change-smartcard-in.xml b/tests/xmlparse-xml/change-smartcard-in.xml
index ddb957123..d36d85e32 100644
--- a/tests/xmlparse-xml/change-smartcard-in.xml
+++ b/tests/xmlparse-xml/change-smartcard-in.xml
@@ -54,6 +54,13 @@
+
+
+
+
+
+
+
diff --git a/tests/xmlparse-xml/change-smartcard-out.xml b/tests/xmlparse-xml/change-smartcard-out.xml
index eac391b11..08ce2d107 100644
--- a/tests/xmlparse-xml/change-smartcard-out.xml
+++ b/tests/xmlparse-xml/change-smartcard-out.xml
@@ -54,6 +54,13 @@
+
+
+
+
+
+
+
diff --git a/tests/xmlparse.py b/tests/xmlparse.py
index a41cbf593..22aa37ca5 100644
--- a/tests/xmlparse.py
+++ b/tests/xmlparse.py
@@ -966,6 +966,8 @@ class XMLParseTest(unittest.TestCase):
dev1 = guest.devices.smartcard[0]
dev2 = guest.devices.smartcard[1]
+ dev3 = guest.devices.smartcard[2]
+ dev4 = guest.devices.smartcard[3]
check = self._make_checker(dev1)
check("type", None, "tcp")
@@ -974,6 +976,16 @@ class XMLParseTest(unittest.TestCase):
check("mode", "passthrough", "host")
check("type", "spicevmc", None)
+ check = self._make_checker(dev3)
+ check("type", "tcp")
+ check("source.host", "127.0.0.1")
+ check("source.service", 2001)
+
+ check = self._make_checker(dev4)
+ check("type", "unix")
+ check("source.path", "/tmp/smartcard.sock")
+ check("source.mode", "bind")
+
self._alter_compare(guest.get_xml(), outfile)
def testAlterRedirdev(self):
diff --git a/virtinst/devices/smartcard.py b/virtinst/devices/smartcard.py
index c2df7ba1b..ceb743103 100644
--- a/virtinst/devices/smartcard.py
+++ b/virtinst/devices/smartcard.py
@@ -4,8 +4,9 @@
# 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 XMLProperty
+from ..xmlbuilder import XMLChildProperty, XMLProperty
class DeviceSmartcard(Device):
@@ -14,6 +15,7 @@ class DeviceSmartcard(Device):
mode = XMLProperty("./@mode")
type = XMLProperty("./@type")
+ source = XMLChildProperty(CharSource, is_single=True)
##################