From c3a1856890b9d75df08a66a95ac5a217b3aadc89 Mon Sep 17 00:00:00 2001
From: Christian Schoenebeck
Date: Mon, 30 Mar 2020 20:05:33 +0200
Subject: [PATCH] conf: add 'multidevs' option
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Introduce new 'multidevs' option for filesystem.
This option prevents misbehaviours on guest if a qemu 9pfs export
contains multiple devices, due to the potential file ID collisions
this otherwise may cause.
Signed-off-by: Christian Schoenebeck
Signed-off-by: Ján Tomko
Reviewed-by: Ján Tomko
---
docs/formatdomain.html.in | 40 ++++++++++++-
docs/schemas/domaincommon.rng | 10 ++++
src/conf/domain_conf.c | 29 ++++++++++
src/conf/domain_conf.h | 13 +++++
.../qemuxml2argvdata/virtio-9p-multidevs.xml | 53 ++++++++++++++++++
.../virtio-9p-multidevs.x86_64-latest.xml | 56 +++++++++++++++++++
tests/qemuxml2xmltest.c | 2 +
7 files changed, 202 insertions(+), 1 deletion(-)
create mode 100644 tests/qemuxml2argvdata/virtio-9p-multidevs.xml
create mode 100644 tests/qemuxml2xmloutdata/virtio-9p-multidevs.x86_64-latest.xml
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index aaeb05961f..fbffb16866 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -3973,7 +3973,7 @@
<source name='my-vm-template'/>
<target dir='/'/>
</filesystem>
- <filesystem type='mount' accessmode='passthrough'>
+ <filesystem type='mount' accessmode='passthrough' multidevs='remap'>
<driver type='path' wrpolicy='immediate'/>
<source dir='/export/to/guest'/>
<target dir='/import/from/host'/>
@@ -4098,6 +4098,44 @@
for more details.
+
+ The filesystem element has an optional attribute multidevs
+ which specifies how to deal with a filesystem export containing more than
+ one device, in order to avoid file ID collisions on guest when using 9pfs
+ (since 6.3.0, requires QEMU 4.2).
+ This attribute is not available for virtiofs. The possible values are:
+
+
+
+
default
+
+ Use QEMU's default setting (which currently is warn).
+
+
remap
+
+ This setting allows guest to access multiple devices per export without
+ encountering misbehaviours. Inode numbers from host are automatically
+ remapped on guest to actively prevent file ID collisions if guest
+ accesses one export containing multiple devices.
+
+
forbid
+
+ Only allow to access one device per export by guest. Attempts to access
+ additional devices on the same export will cause the individual
+ filesystem access by guest to fail with an error and being logged (once)
+ as error on host side.
+
+
warn
+
+ This setting resembles the behaviour of 9pfs prior to QEMU 4.2, that is
+ no action is performed to prevent any potential file ID collisions if an
+ export contains multiple devices, with the only exception: a warning is
+ logged (once) on host side now. This setting may lead to misbehaviours
+ on guest side if more than one device is exported per export, due to the
+ potential file ID collisions this may cause on guest side in that case.
+