Re: [libvirt] [PATCH v2] support for QEMU vhost-user

2014-07-16 Thread Michal Privoznik
On 11.07.2014 19:47, Michele Paolino wrote:
> This patch adds support for the QEMU vhost-user feature to libvirt.
> vhost-user enables the communication between a QEMU virtual machine
> and other userspace process using the Virtio transport protocol.
> It uses a char dev (e.g. Unix socket) for the control plane,
> while the data plane based on shared memory.
> 
> The XML looks like:
> 
> 
>  
>  
>  
> 
> 
> changes from v1:
>   * addressed comments
>   * removed unnecessary checks
>   * series merged in a single patch

We tend to write the diff to previous versions into notes not in the commit 
message as it pollutes git log.

BTW: I didn't ask the whole patchset to be merged into a single patch, but it 
doesn't hurt in this specific case either (the diff stat seems reasonably big).

> 
> The previous version of this patch can be found at:
> http://www.redhat.com/archives/libvir-list/2014-July/msg00111.html
> 
> Signed-off-by: Michele Paolino 
> ---
>   docs/formatdomain.html.in  | 34 +
>   docs/schemas/domaincommon.rng  | 25 +++
>   src/conf/domain_conf.c | 87 
> ++
>   src/conf/domain_conf.h | 10 ++-
>   src/libxl/libxl_conf.c |  1 +
>   src/lxc/lxc_process.c  |  1 +
>   src/qemu/qemu_command.c| 63 
>   src/uml/uml_conf.c |  5 ++
>   src/xenxs/xen_sxpr.c   |  1 +
>   .../qemuxml2argv-net-vhostuser.args|  7 ++
>   .../qemuxml2argv-net-vhostuser.xml | 33 
>   tests/qemuxml2argvtest.c   |  1 +
>   tests/qemuxml2xmltest.c|  1 +
>   13 files changed, 267 insertions(+), 2 deletions(-)
>   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
> Since 0.9.5
>   
>   
> +vhost-user interface
> +
> +
> + 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.
> +
> +
> +
> +  ...
> +  
> +
> +  
> +  
> +  
> +  
> +  
> +  


I don't think so. Empty bodies elements are written as . And that's how 
libvirt formats them too. And if I were to be really picky,  is formated 
before .

> +
> +  
> +  ...
> +
> +
> +  The  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 mode='server' and mode='client'
> +  are supported.
> +  vhost-user requires the virtio model type, thus the
> +   element is mandatory.
> +

I think it would be useful for users reading the documentation to know what 
version of libvirt was this introduced in.

> +
>   Input devices
>   
>   
> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
> index af51eee..c9c02b6 100644
> --- a/docs/schemas/domaincommon.rng
> +++ b/docs/schemas/domaincommon.rng
> @@ -1968,6 +1968,31 @@
>   
>   
> 
> +vhostuser
> +  
> +  
> +  
> +
> +  
> +unix
> +  
> +
> +
> +  
> +
> +
> +  
> +server
> +client
> +  
> +
> +
> +  
> +
> +  
> +
> +
> +  
>   network
> 
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 8df43b7..fb286c6 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -349,6 +349,7 @@ VIR_ENUM_IMPL(virDomainFSWrpolicy, 
> VIR_DOMAIN_FS_WRPOLICY_LAST,
>   VIR_ENUM_IMPL(virDomainNet, VIR_DOMAIN_NET_TYPE_LAST,
> "user",
> "ethernet",
> +  "vhostuser",
> "server",
> "client",
> "mcast",
> @@ -1361,6 +1362,1

[libvirt] [PATCH v2] support for QEMU vhost-user

2014-07-11 Thread Michele Paolino
This patch adds support for the QEMU vhost-user feature to libvirt.
vhost-user enables the communication between a QEMU virtual machine
and other userspace process using the Virtio transport protocol.
It uses a char dev (e.g. Unix socket) for the control plane,
while the data plane based on shared memory.

The XML looks like:







changes from v1:
 * addressed comments
 * removed unnecessary checks
 * series merged in a single patch

The previous version of this patch can be found at:
http://www.redhat.com/archives/libvir-list/2014-July/msg00111.html

Signed-off-by: Michele Paolino 
---
 docs/formatdomain.html.in  | 34 +
 docs/schemas/domaincommon.rng  | 25 +++
 src/conf/domain_conf.c | 87 ++
 src/conf/domain_conf.h | 10 ++-
 src/libxl/libxl_conf.c |  1 +
 src/lxc/lxc_process.c  |  1 +
 src/qemu/qemu_command.c| 63 
 src/uml/uml_conf.c |  5 ++
 src/xenxs/xen_sxpr.c   |  1 +
 .../qemuxml2argv-net-vhostuser.args|  7 ++
 .../qemuxml2argv-net-vhostuser.xml | 33 
 tests/qemuxml2argvtest.c   |  1 +
 tests/qemuxml2xmltest.c|  1 +
 13 files changed, 267 insertions(+), 2 deletions(-)
 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
   Since 0.9.5
 
 
+vhost-user interface
+
+
+ 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.
+
+
+
+  ...
+  
+
+  
+  
+  
+  
+  
+  
+
+  
+  ...
+
+
+  The  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 mode='server' and mode='client'
+  are supported.
+  vhost-user requires the virtio model type, thus the
+   element is mandatory.
+
+
 Input devices
 
 
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index af51eee..c9c02b6 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1968,6 +1968,31 @@
 
 
   
+vhostuser
+  
+  
+  
+
+  
+unix
+  
+
+
+  
+
+
+  
+server
+client
+  
+
+
+  
+
+  
+
+
+  
 network
   
   
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 8df43b7..fb286c6 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -349,6 +349,7 @@ VIR_ENUM_IMPL(virDomainFSWrpolicy, 
VIR_DOMAIN_FS_WRPOLICY_LAST,
 VIR_ENUM_IMPL(virDomainNet, VIR_DOMAIN_NET_TYPE_LAST,
   "user",
   "ethernet",
+  "vhostuser",
   "server",
   "client",
   "mcast",
@@ -1361,6 +1362,10 @@ void virDomainNetDefFree(virDomainNetDefPtr def)
 VIR_FREE(def->data.ethernet.ipaddr);
 break;
 
+case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
+virDomainChrSourceDefFree(def->data.vhostuser);
+break;
+
 case VIR_DOMAIN_NET_TYPE_SERVER:
 case VIR_DOMAIN_NET_TYPE_CLIENT:
 case VIR_DOMAIN_NET_TYPE_MCAST:
@@ -6665,6 +6670,9 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
 char *mode = NULL;
 char *linkstate = NULL;
 char *addrtype = NULL;
+char *vhostuser_mode = NULL;
+char *vhostuser_path = NULL;
+char *vhostuser_type = NULL;
 virNWFilterHashTablePtr filterparams = NULL;
 virDomainActualNetDefPtr actual = NULL;
 xmlNodePtr oldnode = ctxt->node;
@@ -6710,6 +6718,12 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
xmlStrEqual(cur->name, BAD_CAST "source")) {
 dev  = vi