]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
conf: tests: fix virDomainNetDefFormat for vhost-user in client mode
authorMaxime Leroy <maxime.leroy@6wind.com>
Fri, 17 Oct 2014 16:45:18 +0000 (18:45 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 20 Oct 2014 06:58:09 +0000 (08:58 +0200)
The mode attribute is required for the source element of vhost-user.
Thus virDomainNetDefFormat should always generate a xml with it and not
only when the mode is server.

The commit fixes the issue. And it adds a vhostuser interface in
'client' mode to qemuxml2argv-net-vhostuser.(args|xml) to test this
usecase.

Signed-off-by: Maxime Leroy <maxime.leroy@6wind.com>
src/conf/domain_conf.c
tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser.args
tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser.xml

index 42c022370d3e3d64e6e23876825929efa2f3d08d..73c199e80bb2793191e90fc9c634afc5b43b2427 100644 (file)
@@ -17082,8 +17082,9 @@ virDomainNetDefFormat(virBufferPtr buf,
                 virBufferAddLit(buf, "<source type='unix'");
                 virBufferEscapeString(buf, " path='%s'",
                                       def->data.vhostuser->data.nix.path);
-                if (def->data.vhostuser->data.nix.listen)
-                    virBufferAddLit(buf, " mode='server'");
+                virBufferAsprintf(buf, " mode='%s'",
+                                  def->data.vhostuser->data.nix.listen ?
+                                  "server"  : "client");
                 virBufferAddLit(buf, "/>\n");
             }
             break;
index cc66ec3ff9befb21d891b3efb7ffa6ee3e112deb..26daac3984d6b6c9694b4ef0f9150c5ecb18c833 100644 (file)
@@ -2,6 +2,9 @@ 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 \
+-chardev socket,id=charnet0,path=/tmp/vhost0.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
+-device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:ee:96:6b,bus=pci.0,addr=0x3 \
+-chardev socket,id=charnet1,path=/tmp/vhost1.sock \
+-netdev type=vhost-user,id=hostnet1,chardev=charnet1 \
+-device virtio-net-pci,netdev=hostnet1,id=net1,mac=52:54:00:ee:96:6c,bus=pci.0,addr=0x4
index b49d48ef93ba5ffa1441b0b56963f638a7d09a69..e5b6242e40d2219ad105882b42f00cdc29697333 100644 (file)
     <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'/>
+      <source type='unix' path='/tmp/vhost0.sock' mode='server'/>
+      <model type='virtio'/>
+    </interface>
+    <interface type='vhostuser'>
+      <mac address='52:54:00:ee:96:6c'/>
+      <source type='unix' path='/tmp/vhost1.sock' mode='client'/>
       <model type='virtio'/>
     </interface>
     <memballoon model='none'/>