|
|
fbe740 |
From ee1081b3b87179b5b9ed6a1d14694962fa04a5fd Mon Sep 17 00:00:00 2001
|
|
|
fbe740 |
Message-Id: <ee1081b3b87179b5b9ed6a1d14694962fa04a5fd@dist-git>
|
|
|
fbe740 |
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
|
|
|
fbe740 |
Date: Wed, 4 Mar 2020 12:42:40 +0100
|
|
|
fbe740 |
Subject: [PATCH] docs: add virtiofs kbase
|
|
|
fbe740 |
MIME-Version: 1.0
|
|
|
fbe740 |
Content-Type: text/plain; charset=UTF-8
|
|
|
fbe740 |
Content-Transfer-Encoding: 8bit
|
|
|
fbe740 |
|
|
|
fbe740 |
Add a document describing the usage of virtiofs.
|
|
|
fbe740 |
|
|
|
fbe740 |
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
|
|
fbe740 |
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
|
|
|
fbe740 |
Tested-by: Andrea Bolognani <abologna@redhat.com>
|
|
|
fbe740 |
(cherry picked from commit aecf1f5d702ad710aed99a688f38f05cc304b03a)
|
|
|
fbe740 |
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
|
|
fbe740 |
|
|
|
fbe740 |
Conflicts: * downstream is missing the link to qemu-passthrough-security
|
|
|
fbe740 |
docs/kbase.html.in
|
|
|
fbe740 |
https://bugzilla.redhat.com/show_bug.cgi?id=1694166
|
|
|
fbe740 |
Message-Id: <a037a8c8db2e3be9a54467859b700a9d7ab15429.1583322090.git.jtomko@redhat.com>
|
|
|
fbe740 |
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
fbe740 |
---
|
|
|
fbe740 |
docs/kbase.html.in | 3 +
|
|
|
fbe740 |
docs/kbase/virtiofs.rst | 147 ++++++++++++++++++++++++++++++++++++++++
|
|
|
fbe740 |
2 files changed, 150 insertions(+)
|
|
|
fbe740 |
create mode 100644 docs/kbase/virtiofs.rst
|
|
|
fbe740 |
|
|
|
fbe740 |
diff --git a/docs/kbase.html.in b/docs/kbase.html.in
|
|
|
fbe740 |
index c156414c41..7d6caf3cb1 100644
|
|
|
fbe740 |
--- a/docs/kbase.html.in
|
|
|
fbe740 |
+++ b/docs/kbase.html.in
|
|
|
fbe740 |
@@ -29,6 +29,9 @@
|
|
|
fbe740 |
Backing chain management
|
|
|
fbe740 |
Explanation of how disk backing chain specification impacts libvirt's
|
|
|
fbe740 |
behaviour and basic troubleshooting steps of disk problems.
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ Virtio-FS
|
|
|
fbe740 |
+ Share a filesystem between the guest and the host
|
|
|
fbe740 |
|
|
|
fbe740 |
|
|
|
fbe740 |
|
|
|
fbe740 |
diff --git a/docs/kbase/virtiofs.rst b/docs/kbase/virtiofs.rst
|
|
|
fbe740 |
new file mode 100644
|
|
|
fbe740 |
index 0000000000..68fbafcf37
|
|
|
fbe740 |
--- /dev/null
|
|
|
fbe740 |
+++ b/docs/kbase/virtiofs.rst
|
|
|
fbe740 |
@@ -0,0 +1,147 @@
|
|
|
fbe740 |
+============================
|
|
|
fbe740 |
+Sharing files with Virtio-FS
|
|
|
fbe740 |
+============================
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+.. contents::
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+=========
|
|
|
fbe740 |
+Virtio-FS
|
|
|
fbe740 |
+=========
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+Virtio-FS is a shared file system that lets virtual machines access
|
|
|
fbe740 |
+a directory tree on the host. Unlike existing approaches, it
|
|
|
fbe740 |
+is designed to offer local file system semantics and performance.
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+See https://virtio-fs.gitlab.io/
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+==========
|
|
|
fbe740 |
+Host setup
|
|
|
fbe740 |
+==========
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+The host-side virtiofsd daemon, like other vhost-user backed devices,
|
|
|
fbe740 |
+requires shared memory between the host and the guest. As of QEMU 4.2, this
|
|
|
fbe740 |
+requires specifying a NUMA topology for the guest and explicitly specifying
|
|
|
fbe740 |
+a memory backend. Multiple options are available:
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+Either of the following:
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+* Use file-backed memory
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ Configure the directory where the files backing the memory will be stored
|
|
|
fbe740 |
+ with the ``memory_backing_dir`` option in ``/etc/libvirt/qemu.conf``
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ ::
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ # This directory is used for memoryBacking source if configured as file.
|
|
|
fbe740 |
+ # NOTE: big files will be stored here
|
|
|
fbe740 |
+ memory_backing_dir = "/dev/shm/"
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+* Use hugepage-backed memory
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ Make sure there are enough huge pages allocated for the requested guest memory.
|
|
|
fbe740 |
+ For example, for one guest with 2 GiB of RAM backed by 2 MiB hugepages:
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ ::
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ # virsh allocpages 2M 1024
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+===========
|
|
|
fbe740 |
+Guest setup
|
|
|
fbe740 |
+===========
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+#. Specify the NUMA topology
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ in the domain XML of the guest.
|
|
|
fbe740 |
+ For the simplest one-node topology for a guest with 2GiB of RAM and 8 vCPUs:
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ ::
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ <domain>
|
|
|
fbe740 |
+ ...
|
|
|
fbe740 |
+ <cpu ...>
|
|
|
fbe740 |
+ <numa>
|
|
|
fbe740 |
+ <cell id='0' cpus='0-7' memory='2' unit='GiB' memAccess='shared'/>
|
|
|
fbe740 |
+ </numa>
|
|
|
fbe740 |
+ </cpu>
|
|
|
fbe740 |
+ ...
|
|
|
fbe740 |
+ </domain>
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ Note that the CPU element might already be specified and only one is allowed.
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+#. Specify the memory backend
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ Either of the following:
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ * File-backed memory
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ ::
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ <domain>
|
|
|
fbe740 |
+ ...
|
|
|
fbe740 |
+ <memoryBacking>
|
|
|
fbe740 |
+ <access mode='shared'/>
|
|
|
fbe740 |
+ </memoryBacking>
|
|
|
fbe740 |
+ ...
|
|
|
fbe740 |
+ </domain>
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ This will create a file in the directory specified in ``qemu.conf``
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ * Hugepage-backed memory
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ ::
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ <domain>
|
|
|
fbe740 |
+ ...
|
|
|
fbe740 |
+ <memoryBacking>
|
|
|
fbe740 |
+ <hugepages>
|
|
|
fbe740 |
+ <page size='2' unit='M'/>
|
|
|
fbe740 |
+ </hugepages>
|
|
|
fbe740 |
+ <access mode='shared'/>
|
|
|
fbe740 |
+ </memoryBacking>
|
|
|
fbe740 |
+ ...
|
|
|
fbe740 |
+ </domain>
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+#. Add the ``vhost-user-fs`` QEMU device via the ``filesystem`` element
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ ::
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ <domain>
|
|
|
fbe740 |
+ ...
|
|
|
fbe740 |
+ <devices>
|
|
|
fbe740 |
+ ...
|
|
|
fbe740 |
+ <filesystem type='mount' accessmode='passthrough'>
|
|
|
fbe740 |
+ <driver type='virtiofs'/>
|
|
|
fbe740 |
+ <source dir='/path'/>
|
|
|
fbe740 |
+ <target dir='mount_tag'/>
|
|
|
fbe740 |
+ </filesystem>
|
|
|
fbe740 |
+ ...
|
|
|
fbe740 |
+ </devices>
|
|
|
fbe740 |
+ </domain>
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ Note that despite its name, the ``target dir`` is actually a mount tag and does
|
|
|
fbe740 |
+ not have to correspond to the desired mount point in the guest.
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ So far, ``passthrough`` is the only supported access mode and it requires
|
|
|
fbe740 |
+ running the ``virtiofsd`` daemon as root.
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+#. Boot the guest and mount the filesystem
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ ::
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ guest# mount -t virtiofs mount_tag /mnt/mount/path
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ Note: this requires virtiofs support in the guest kernel (Linux v5.4 or later)
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+===================
|
|
|
fbe740 |
+Optional parameters
|
|
|
fbe740 |
+===================
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+More optional elements can be specified
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+::
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ <driver type='virtiofs' queue='1024'/>
|
|
|
fbe740 |
+ <binary path='/usr/libexec/virtiofsd' xattr='on'>
|
|
|
fbe740 |
+ <cache mode='always'/>
|
|
|
fbe740 |
+ <lock posix_lock='on' flock='on'/>
|
|
|
fbe740 |
+ </binary>
|
|
|
fbe740 |
--
|
|
|
fbe740 |
2.25.1
|
|
|
fbe740 |
|