[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [v3 14/14] Learn to use spicevmc as a redirection type for usb-redir



---
 src/conf/domain_conf.c                             |    7 ++++++-
 src/conf/domain_conf.h                             |    1 +
 tests/qemuxml2argvdata/qemuxml2argv-usb-redir.args |    2 ++
 tests/qemuxml2argvdata/qemuxml2argv-usb-redir.xml  |    2 ++
 tests/qemuxml2argvtest.c                           |    3 ++-
 5 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 08d957a..9435abd 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -289,7 +289,8 @@ VIR_ENUM_IMPL(virDomainChrTcpProtocol, VIR_DOMAIN_CHR_TCP_PROTOCOL_LAST,
 
 VIR_ENUM_IMPL(virDomainChrSpicevmc, VIR_DOMAIN_CHR_SPICEVMC_LAST,
               "vdagent",
-              "smartcard")
+              "smartcard",
+              "usbredir")
 
 VIR_ENUM_IMPL(virDomainSmartcard, VIR_DOMAIN_SMARTCARD_TYPE_LAST,
               "host",
@@ -5512,6 +5513,10 @@ virDomainRedirdevDefParseXML(const xmlNodePtr node,
         cur = cur->next;
     }
 
+    if (def->source.chr.type == VIR_DOMAIN_CHR_TYPE_SPICEVMC) {
+        def->source.chr.data.spicevmc = VIR_DOMAIN_CHR_SPICEVMC_USBREDIR;
+    }
+
 cleanup:
     VIR_FREE(bus);
     VIR_FREE(type);
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index c79610c..027ac67 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -537,6 +537,7 @@ enum virDomainChrTcpProtocol {
 enum virDomainChrSpicevmcName {
     VIR_DOMAIN_CHR_SPICEVMC_VDAGENT,
     VIR_DOMAIN_CHR_SPICEVMC_SMARTCARD,
+    VIR_DOMAIN_CHR_SPICEVMC_USBREDIR,
 
     VIR_DOMAIN_CHR_SPICEVMC_LAST,
 };
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-redir.args b/tests/qemuxml2argvdata/qemuxml2argv-usb-redir.args
index 445aa5f..4d4f30a 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-usb-redir.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-redir.args
@@ -5,4 +5,6 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc
 -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,multifunction=on,addr=0x4.0x2 \
 -chardev socket,id=charredir0,host=localhost,port=4000 \
 -device usb-redir,chardev=charredir0,id=redir0 \
+-chardev spicevmc,id=charredir1,name=usbredir \
+-device usb-redir,chardev=charredir1,id=redir1 \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,multifunction=on,addr=0x3.0x0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-redir.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb-redir.xml
index d644216..c73e569 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-usb-redir.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-redir.xml
@@ -33,6 +33,8 @@
       <source mode='connect' host='localhost' service='4000'/>
       <protocol type='raw'/>
     </redirdev>
+    <redirdev bus='usb' type='spicevmc'>
+    </redirdev>
     <memballoon model='virtio'/>
   </devices>
 </domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 35e6d27..090ec7a 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -511,7 +511,8 @@ mymain(void)
     DO_TEST("usb-redir", false,
             QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
             QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_USB_HUB,
-            QEMU_CAPS_ICH9_USB_EHCI1, QEMU_CAPS_USB_REDIR);
+            QEMU_CAPS_ICH9_USB_EHCI1, QEMU_CAPS_USB_REDIR,
+            QEMU_CAPS_SPICE, QEMU_CAPS_CHARDEV_SPICEVMC);
 
     DO_TEST("smbios", false, QEMU_CAPS_SMBIOS_TYPE);
 
-- 
1.7.6


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]