|
|
9119d9 |
From f454878890e760257de9e59daecf875b5645ec05 Mon Sep 17 00:00:00 2001
|
|
|
9119d9 |
Message-Id: <f454878890e760257de9e59daecf875b5645ec05@dist-git>
|
|
|
9119d9 |
From: Maxime Leroy <maxime.leroy@6wind.com>
|
|
|
9119d9 |
Date: Wed, 22 Oct 2014 10:58:14 +0200
|
|
|
9119d9 |
Subject: [PATCH] conf: tests: fix virDomainNetDefFormat for vhost-user in
|
|
|
9119d9 |
client mode
|
|
|
9119d9 |
|
|
|
9119d9 |
The mode attribute is required for the source element of vhost-user.
|
|
|
9119d9 |
Thus virDomainNetDefFormat should always generate a xml with it and not
|
|
|
9119d9 |
only when the mode is server.
|
|
|
9119d9 |
|
|
|
9119d9 |
The commit fixes the issue. And it adds a vhostuser interface in
|
|
|
9119d9 |
'client' mode to qemuxml2argv-net-vhostuser.(args|xml) to test this
|
|
|
9119d9 |
usecase.
|
|
|
9119d9 |
|
|
|
9119d9 |
Signed-off-by: Maxime Leroy <maxime.leroy@6wind.com>
|
|
|
9119d9 |
(cherry picked from commit 302720742f6e159af45631475d720cf807e905b9)
|
|
|
9119d9 |
|
|
|
9119d9 |
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1155458
|
|
|
9119d9 |
|
|
|
9119d9 |
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
|
9119d9 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
9119d9 |
---
|
|
|
9119d9 |
src/conf/domain_conf.c | 5 +++--
|
|
|
9119d9 |
tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser.args | 7 +++++--
|
|
|
9119d9 |
tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser.xml | 7 ++++++-
|
|
|
9119d9 |
3 files changed, 14 insertions(+), 5 deletions(-)
|
|
|
9119d9 |
|
|
|
9119d9 |
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
|
|
9119d9 |
index d1d816d..58d5b80 100644
|
|
|
9119d9 |
--- a/src/conf/domain_conf.c
|
|
|
9119d9 |
+++ b/src/conf/domain_conf.c
|
|
|
9119d9 |
@@ -16900,8 +16900,9 @@ virDomainNetDefFormat(virBufferPtr buf,
|
|
|
9119d9 |
virBufferAddLit(buf, "
|
|
|
9119d9 |
virBufferEscapeString(buf, " path='%s'",
|
|
|
9119d9 |
def->data.vhostuser->data.nix.path);
|
|
|
9119d9 |
- if (def->data.vhostuser->data.nix.listen)
|
|
|
9119d9 |
- virBufferAddLit(buf, " mode='server'");
|
|
|
9119d9 |
+ virBufferAsprintf(buf, " mode='%s'",
|
|
|
9119d9 |
+ def->data.vhostuser->data.nix.listen ?
|
|
|
9119d9 |
+ "server" : "client");
|
|
|
9119d9 |
virBufferAddLit(buf, "/>\n");
|
|
|
9119d9 |
}
|
|
|
9119d9 |
break;
|
|
|
9119d9 |
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser.args b/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser.args
|
|
|
9119d9 |
index cc66ec3..26daac3 100644
|
|
|
9119d9 |
--- a/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser.args
|
|
|
9119d9 |
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser.args
|
|
|
9119d9 |
@@ -2,6 +2,9 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
|
|
|
9119d9 |
/usr/bin/qemu -S -M \
|
|
|
9119d9 |
pc -m 214 -smp 1 -nographic -nodefaults -monitor unix:/tmp/test-monitor,server,nowait \
|
|
|
9119d9 |
-no-acpi -boot c -usb -hda /dev/HostVG/QEMUGuest1 \
|
|
|
9119d9 |
--chardev socket,id=charnet0,path=/tmp/vhost.sock,server \
|
|
|
9119d9 |
+-chardev socket,id=charnet0,path=/tmp/vhost0.sock,server \
|
|
|
9119d9 |
-netdev type=vhost-user,id=hostnet0,chardev=charnet0 \
|
|
|
9119d9 |
--device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:ee:96:6b,bus=pci.0,addr=0x3
|
|
|
9119d9 |
+-device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:ee:96:6b,bus=pci.0,addr=0x3 \
|
|
|
9119d9 |
+-chardev socket,id=charnet1,path=/tmp/vhost1.sock \
|
|
|
9119d9 |
+-netdev type=vhost-user,id=hostnet1,chardev=charnet1 \
|
|
|
9119d9 |
+-device virtio-net-pci,netdev=hostnet1,id=net1,mac=52:54:00:ee:96:6c,bus=pci.0,addr=0x4
|
|
|
9119d9 |
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser.xml b/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser.xml
|
|
|
9119d9 |
index b49d48e..e5b6242 100644
|
|
|
9119d9 |
--- a/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser.xml
|
|
|
9119d9 |
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser.xml
|
|
|
9119d9 |
@@ -25,7 +25,12 @@
|
|
|
9119d9 |
<controller type='pci' index='0' model='pci-root'/>
|
|
|
9119d9 |
<interface type='vhostuser'>
|
|
|
9119d9 |
<mac address='52:54:00:ee:96:6b'/>
|
|
|
9119d9 |
- <source type='unix' path='/tmp/vhost.sock' mode='server'/>
|
|
|
9119d9 |
+ <source type='unix' path='/tmp/vhost0.sock' mode='server'/>
|
|
|
9119d9 |
+ <model type='virtio'/>
|
|
|
9119d9 |
+ </interface>
|
|
|
9119d9 |
+ <interface type='vhostuser'>
|
|
|
9119d9 |
+ <mac address='52:54:00:ee:96:6c'/>
|
|
|
9119d9 |
+ <source type='unix' path='/tmp/vhost1.sock' mode='client'/>
|
|
|
9119d9 |
<model type='virtio'/>
|
|
|
9119d9 |
</interface>
|
|
|
9119d9 |
<memballoon model='none'/>
|
|
|
9119d9 |
--
|
|
|
9119d9 |
2.1.3
|
|
|
9119d9 |
|