[libvirt PATCHv5 15/15] qemu: build vhost-user-fs device command line

Peter Krempa pkrempa at redhat.com
Wed Feb 26 12:54:56 UTC 2020


On Wed, Feb 26, 2020 at 12:57:13 +0100, Ján Tomko wrote:
> Format the 'vhost-user-fs' device on the QEMU command line.
> 
> This device provides shared file system access using the FUSE protocol
> carried over virtio.
> The actual file server is implemented in an external vhost-user-fs device
> backend process.
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=1694166
> 
> Signed-off-by: Ján Tomko <jtomko at redhat.com>
> Reviewed-by: Daniel P. Berrangé <berrange at redhat.com>
> ---
>  src/qemu/qemu_command.c                       | 46 +++++++++++++++++-
>  ...vhost-user-fs-fd-memory.x86_64-latest.args | 39 +++++++++++++++
>  ...vhost-user-fs-hugepages.x86_64-latest.args | 47 +++++++++++++++++++
>  tests/qemuxml2argvtest.c                      |  3 ++
>  4 files changed, 133 insertions(+), 2 deletions(-)
>  create mode 100644 tests/qemuxml2argvdata/vhost-user-fs-fd-memory.x86_64-latest.args
>  create mode 100644 tests/qemuxml2argvdata/vhost-user-fs-hugepages.x86_64-latest.args
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 8ad859ad88..9d215e5e06 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -2575,6 +2575,46 @@ qemuBuildDisksCommandLine(virCommandPtr cmd,
>  }
>  
>  
> +static int
> +qemuBuildVHostUserFsCommandLine(virCommandPtr cmd,
> +                                virDomainFSDef *fs,
> +                                const virDomainDef *def,
> +                                qemuDomainObjPrivatePtr priv)
> +{
> +    g_autofree char *chardev_alias = NULL;
> +    g_auto(virBuffer) opt = VIR_BUFFER_INITIALIZER;
> +
> +    chardev_alias = g_strdup_printf("chr-vu-%s", fs->info.alias);
> +
> +    virCommandAddArg(cmd, "-chardev");
> +    virBufferAddLit(&opt, "socket");
> +    virBufferAsprintf(&opt, ",id=%s", chardev_alias);
> +    virBufferAddLit(&opt, ",path=");
> +    virQEMUBuildBufferEscapeComma(&opt, QEMU_DOMAIN_FS_PRIVATE(fs)->vhostuser_fs_sock);

You don't really need this as it's not user controlled and we don't use
commas.

Reviewed-by: Peter Krempa <pkrempa at redhat.com>




More information about the libvir-list mailing list