[libvirt] [PATCH 3/4] vhost-user support: tests and docs

Michele Paolino m.paolino at virtualopensystems.com
Wed Jul 2 13:20:17 UTC 2014


This patch adds the test files and the documentation for vhost-user.

Signed-off-by: Michele Paolino <m.paolino at virtualopensystems.com>
---
 docs/formatdomain.html.in                          | 34 +++++++++++++++++++
 docs/schemas/domaincommon.rng                      | 39 ++++++++++++++++++++++
 .../qemuxml2argv-net-vhostuser.args                |  7 ++++
 .../qemuxml2argv-net-vhostuser.xml                 | 33 ++++++++++++++++++
 tests/qemuxml2argvtest.c                           |  1 +
 tests/qemuxml2xmltest.c                            |  1 +
 6 files changed, 115 insertions(+)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser.xml

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 3f8bbee..606b7d4 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -3927,6 +3927,40 @@ qemu-kvm -net nic,model=? /dev/null
       <span class="since">Since 0.9.5</span>
     </p>
 
+    <h5><a name="elementVhostuser">vhost-user interface</a></h5>
+
+    <p>
+     vhost-user enables the communication between a QEMU virtual machine
+     and other userspace process using the Virtio transport protocol.
+     A char dev (e.g. Unix socket) is used for the control plane, while
+     the data plane is based on shared memory.
+    </p>
+
+<pre>
+  ...
+  <devices>
+    <interface type='vhostuser'>
+      <source type='unix' path='/tmp/vhost.sock' mode='server'>
+      </source>
+      <mac address='52:54:00:3b:83:1a'>
+      </mac>
+      <model type='virtio'>
+      </model>
+    </interface>
+  </devices>
+  ...</pre>
+
+    <p>
+      The <code><source></code> element has to be specified
+      along with the type of char device.
+      Currently, only type='unix' is supported, where the path (the
+      directory path of the socket) and mode attributes are required.
+      Both <code>mode='server'</code> and <code>mode='client'</code>
+      are supported.
+      vhost-user requires the virtio model type, thus the
+      <code><model></code> element is mandatory.
+    </p>
+
     <h4><a name="elementsInput">Input devices</a></h4>
 
     <p>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index af51eee..f85dd61 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1968,6 +1968,45 @@
         </group>
         <group>
           <attribute name="type">
+            <value>vhostuser</value>
+          </attribute>
+          <interleave>
+            <optional>
+              <element name="source">
+                <attribute name="type">
+                  <choice>
+                    <value>null</value>
+                    <value>vc</value>
+                    <value>pty</value>
+                    <value>dev</value>
+                    <value>file</value>
+                    <value>pipe</value>
+                    <value>stdio</value>
+                    <value>udp</value>
+                    <value>tcp</value>
+                    <value>unix</value>
+                    <value>spicevmc</value>
+                    <value>spiceport</value>
+                    <value>nmdm</value>
+                  </choice>
+                </attribute>
+                <attribute name="path">
+                  <ref name="absFilePath"/>
+                </attribute>
+                <attribute name="mode">
+                  <choice>
+                    <value>server</value>
+                    <value>client</value>
+                  </choice>
+                </attribute>
+                <empty/>
+              </element>
+            </optional>
+            <ref name="interface-options"/>
+          </interleave>
+        </group>
+        <group>
+          <attribute name="type">
             <value>network</value>
           </attribute>
           <interleave>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser.args b/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser.args
new file mode 100644
index 0000000..cc66ec3
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser.args
@@ -0,0 +1,7 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu -S -M \
+pc -m 214 -smp 1 -nographic -nodefaults -monitor unix:/tmp/test-monitor,server,nowait \
+-no-acpi -boot c -usb -hda /dev/HostVG/QEMUGuest1 \
+-chardev socket,id=charnet0,path=/tmp/vhost.sock,server \
+-netdev type=vhost-user,id=hostnet0,chardev=charnet0 \
+-device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:ee:96:6b,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser.xml b/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser.xml
new file mode 100644
index 0000000..b49d48e
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser.xml
@@ -0,0 +1,33 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</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>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <interface type='vhostuser'>
+      <mac address='52:54:00:ee:96:6b'/>
+      <source type='unix' path='/tmp/vhost.sock' mode='server'/>
+      <model type='virtio'/>
+    </interface>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index b4414d6..d4b082a 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -927,6 +927,7 @@ mymain(void)
     DO_TEST_FAILURE("misc-enable-s4", NONE);
     DO_TEST("misc-no-reboot", NONE);
     DO_TEST("misc-uuid", QEMU_CAPS_NAME, QEMU_CAPS_UUID);
+    DO_TEST("net-vhostuser", QEMU_CAPS_DEVICE, QEMU_CAPS_NETDEV);
     DO_TEST("net-user", NONE);
     DO_TEST("net-virtio", NONE);
     DO_TEST("net-virtio-device",
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 43cd022..1fd0ad1 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -245,6 +245,7 @@ mymain(void)
     DO_TEST("misc-disable-suspends");
     DO_TEST("misc-enable-s4");
     DO_TEST("misc-no-reboot");
+    DO_TEST("net-vhostuser");
     DO_TEST("net-user");
     DO_TEST("net-virtio");
     DO_TEST("net-virtio-device");
-- 
1.9.3




More information about the libvir-list mailing list