]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
conf: parse and format virtio input bus in domain XML
authorJán Tomko <jtomko@redhat.com>
Fri, 13 Nov 2015 10:37:12 +0000 (11:37 +0100)
committerJán Tomko <jtomko@redhat.com>
Mon, 30 Nov 2015 11:22:06 +0000 (12:22 +0100)
To be used by the family of virtio input devices:

<input type='mouse' bus='virtio'/>
<input type='tablet' bus='virtio'/>
<input type='keyboard' bus='virtio'/>

https://bugzilla.redhat.com/show_bug.cgi?id=1231114

docs/formatdomain.html.in
docs/schemas/domaincommon.rng
src/conf/domain_conf.c
src/conf/domain_conf.h
tests/qemuxml2argvdata/qemuxml2argv-virtio-input.xml [new file with mode: 0644]
tests/qemuxml2xmltest.c

index 0e0490e8f623f374beafeb1e8122c518c5aaf56e..df54ad3d02ed17934c1e35a0276f31878f111f66 100644 (file)
@@ -4801,6 +4801,9 @@ qemu-kvm -net nic,model=? /dev/null
   &lt;devices&gt;
     &lt;input type='mouse' bus='usb'/&gt;
     &lt;input type='keyboard' bus='usb'/&gt;
+    &lt;input type='mouse' bus='virtio'/&gt;
+    &lt;input type='keyboard' bus='virtio'/&gt;
+    &lt;input type='tablet' bus='virtio'/&gt;
   &lt;/devices&gt;
   ...</pre>
 
@@ -4812,7 +4815,8 @@ qemu-kvm -net nic,model=? /dev/null
         The tablet provides absolute cursor movement,
         while the mouse uses relative movement. The optional
         <code>bus</code> attribute can be used to refine the exact device type.
-        It takes values "xen" (paravirtualized), "ps2" and "usb".</dd>
+        It takes values "xen" (paravirtualized), "ps2" and "usb" or
+        (<span class="since">since 1.3.0</span>) "virtio".</dd>
     </dl>
 
     <p>
index 284a7e4d6eade1184214a9130a697a207c80135b..6d71199b17c23a6e22830d92749b049b174dcef6 100644 (file)
             <value>ps2</value>
             <value>usb</value>
             <value>xen</value>
+            <value>virtio</value>
           </choice>
         </attribute>
       </optional>
index cbfc41e5ff4d152150c3d77800a69c7f1cdcd665..12b3769ce99f370fa6a0ed99a53be91200da5037 100644 (file)
@@ -550,7 +550,8 @@ VIR_ENUM_IMPL(virDomainInputBus, VIR_DOMAIN_INPUT_BUS_LAST,
               "ps2",
               "usb",
               "xen",
-              "parallels")
+              "parallels",
+              "virtio")
 
 VIR_ENUM_IMPL(virDomainGraphics, VIR_DOMAIN_GRAPHICS_TYPE_LAST,
               "sdl",
@@ -22399,7 +22400,8 @@ virDomainDefFormatInternal(virDomainDefPtr def,
             goto error;
 
     for (n = 0; n < def->ninputs; n++)
-        if (def->inputs[n]->bus == VIR_DOMAIN_INPUT_BUS_USB &&
+        if ((def->inputs[n]->bus == VIR_DOMAIN_INPUT_BUS_USB ||
+             def->inputs[n]->bus == VIR_DOMAIN_INPUT_BUS_VIRTIO) &&
             virDomainInputDefFormat(buf, def->inputs[n], flags) < 0)
             goto error;
 
index c2b7602ac880dc2eefb977a6a08ebbd0367de871..6d2ca55b851d70af5405797b074a68b72e927492 100644 (file)
@@ -1297,6 +1297,7 @@ typedef enum {
     VIR_DOMAIN_INPUT_BUS_USB,
     VIR_DOMAIN_INPUT_BUS_XEN,
     VIR_DOMAIN_INPUT_BUS_PARALLELS, /* pseudo device for VNC in containers */
+    VIR_DOMAIN_INPUT_BUS_VIRTIO,
 
     VIR_DOMAIN_INPUT_BUS_LAST
 } virDomainInputBus;
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-input.xml b/tests/qemuxml2argvdata/qemuxml2argv-virtio-input.xml
new file mode 100644 (file)
index 0000000..11fb566
--- /dev/null
@@ -0,0 +1,26 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='virtio'/>
+    <input type='keyboard' bus='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
+    </input>
+    <input type='tablet' bus='virtio'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
index cabec61478e5d73d870997006c64dbc9d66842fb..4b2cff7aaf0db8ed7c2ba9d19f0593913b412569 100644 (file)
@@ -632,6 +632,7 @@ mymain(void)
 
     DO_TEST("video-virtio-gpu-device");
     DO_TEST("video-virtio-gpu-virgl");
+    DO_TEST("virtio-input");
 
     qemuTestDriverFree(&driver);