Bug 1285697 - [RFE] Add "nowait" support for vhost-user
[RFE] Add "nowait" support for vhost-user
Status: NEW
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev (Show other bugs)
7.3
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Victor Kaplansky
Pei Zhang
: FutureFeature
Depends On:
Blocks: 1288337
  Show dependency treegraph
 
Reported: 2015-11-26 04:57 EST by Amnon Ilan
Modified: 2017-11-01 20:06 EDT (History)
13 users (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Amnon Ilan 2015-11-26 04:57:48 EST
Description of problem:

Vhost-user should support "nowait": when a guest is starting and tries to connect 
to vhost-user, but vhost-user is not up yet for some reason (startup timing, 
vhost-user crash, live migration, etc.), the guest should be able to complete 
it's startup without waiting for vhost-user, and then complete the connections 
async when vhost-user is up.
Comment 1 Peter Ginchev 2017-01-12 06:51:31 EST
The current RHEL 7.3 used libvirtd version 2.0.0 and QEMU version 2.6, below are proposed patches that adds 'nowait' functionality:

QEMU:
diff --git a/net/vhost-user.c b/net/vhost-user.c
index 1b9e73a..aaa223e 100644
--- a/net/vhost-user.c
+++ b/net/vhost-user.c
@@ -239,6 +239,7 @@ static int net_vhost_chardev_opts(void *opaque,
     } else if (strcmp(name, "path") == 0) {
         props->is_unix = true;
     } else if (strcmp(name, "server") == 0) {
+    } else if (strcmp(name, "wait") == 0) {
     } else {
         error_setg(errp,
                    "vhost-user does not support a chardev with option %s=%s",

LIBVIRT:
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 7eb6c0a..7708c90 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7668,7 +7668,7 @@ qemuBuildVhostuserCommandLine(virCommandPtr cmd,
     case VIR_DOMAIN_CHR_TYPE_UNIX:
         virBufferAsprintf(&chardev_buf, "socket,id=char%s,path=%s%s",
                           net->info.alias, net->data.vhostuser->data.nix.path,
-                          net->data.vhostuser->data.nix.listen ? ",server" : "");
+                          net->data.vhostuser->data.nix.listen ? ",server,nowait" : "");
         break;

     case VIR_DOMAIN_CHR_TYPE_NULL:
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser-multiq.args b/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser-multiq.args
index 3229034..f65ead8 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser-multiq.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser-multiq.args
@@ -19,7 +19,7 @@ QEMU_AUDIO_DRV=none \
 -usb \
 -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
 -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
--chardev socket,id=charnet0,path=/tmp/vhost0.sock,server \
+-chardev socket,id=charnet0,path=/tmp/vhost0.sock,server,nowait \
 -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.args b/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser.args
index a9989b8..df334b1 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser.args
@@ -19,7 +19,7 @@ QEMU_AUDIO_DRV=none \
 -usb \
 -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
 -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
--chardev socket,id=charnet0,path=/tmp/vhost0.sock,server \
+-chardev socket,id=charnet0,path=/tmp/vhost0.sock,server,nowait \
 -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 \
Comment 2 Peter Ginchev 2017-01-12 06:54:25 EST
LIBVIRT fix is relevant for all, but QEMU is specific for 2.6, 'master' branch of QEMU drops chardev parameters validation in the way it is done in 2.6, so QEMU master doesn't need a fix

Should I open a new bug for libvirt fix?
Comment 3 Victor Kaplansky 2017-01-12 10:50:54 EST
Hi Peter,

So what do you say is, passing "nowait" as the socket param solves the bug, and the only problem from the QEMU point of view is the ned to validate "nowait" as a legal parameter. Right?

If so, it is still not clear to me why you propose to check in net/vhost-user.c
+    } else if (strcmp(name, "wait") == 0) {
for "wait" instead of "nowait"...


-- 
Victor
Comment 4 Peter Ginchev 2017-01-16 03:29:31 EST
Hi Victor,
After our phone conversation,
I can confirm that I did test vhost-user socket connected at a much later time.
The interface is set up correctly and packets do pass.

Note You need to log in before you can comment on or make changes to this bug.