render / rpms / libvirt

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