From: Christian Schoenebeck <qemu_oss@crudebyte.com>
To: libvir-list@redhat.com
Cc: qemu-devel@nongnu.org, Greg Kurz <groug@kaod.org>
Subject: [PATCH v2 4/4] qemu: add support for 'multidevs' option
Date: Fri, 20 Mar 2020 17:54:32 +0100 [thread overview]
Message-ID: <db76c7042cf249ca51ef0269c824213eb73452b0.1584723663.git.qemu_oss@crudebyte.com> (raw)
In-Reply-To: <cover.1584723662.git.qemu_oss@crudebyte.com>
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 <qemu_oss@crudebyte.com>
---
src/qemu/qemu_command.c | 7 +++++++
src/qemu/qemu_domain.c | 12 ++++++++++++
2 files changed, 19 insertions(+)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 9790c92cf8..7020e5448c 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2632,6 +2632,13 @@ qemuBuildFSStr(virDomainFSDefPtr fs)
} else if (fs->accessmode == VIR_DOMAIN_FS_ACCESSMODE_SQUASH) {
virBufferAddLit(&opt, ",security_model=none");
}
+ if (fs->multidevs == VIR_DOMAIN_FS_MULTIDEVS_REMAP) {
+ virBufferAddLit(&opt, ",multidevs=remap");
+ } else if (fs->multidevs == VIR_DOMAIN_FS_MULTIDEVS_FORBID) {
+ virBufferAddLit(&opt, ",multidevs=forbid");
+ } else if (fs->multidevs == VIR_DOMAIN_FS_MULTIDEVS_WARN) {
+ virBufferAddLit(&opt, ",multidevs=warn");
+ }
} else if (fs->fsdriver == VIR_DOMAIN_FS_DRIVER_TYPE_HANDLE) {
/* removed since qemu 4.0.0 see v3.1.0-29-g93aee84f57 */
virBufferAddLit(&opt, "handle");
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index edc8ba2ddb..c54c64fadb 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -8529,6 +8529,13 @@ qemuDomainDeviceDefValidateFS(virDomainFSDefPtr fs,
_("only supports mount filesystem type"));
return -1;
}
+ if (fs->multidevs != VIR_DOMAIN_FS_MODEL_DEFAULT &&
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTFS_MULTIDEVS))
+ {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("multidevs is not supported with this QEMU binary"));
+ return -1;
+ }
switch ((virDomainFSDriverType) fs->fsdriver) {
case VIR_DOMAIN_FS_DRIVER_TYPE_DEFAULT:
@@ -8581,6 +8588,11 @@ qemuDomainDeviceDefValidateFS(virDomainFSDefPtr fs,
_("virtiofs is not supported with this QEMU binary"));
return -1;
}
+ if (fs->multidevs != VIR_DOMAIN_FS_MULTIDEVS_DEFAULT) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("virtiofs does not support multidevs"));
+ return -1;
+ }
if (qemuDomainDefValidateVirtioFSSharedMemory(def) < 0)
return -1;
break;
--
2.20.1
prev parent reply other threads:[~2020-03-20 18:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-20 17:01 [PATCH v2 0/4] add support for QEMU 9pfs 'multidevs' option Christian Schoenebeck
2020-03-20 16:46 ` [PATCH v2 1/4] docs: virtfs: add section separators Christian Schoenebeck
2020-03-20 16:48 ` [PATCH v2 2/4] qemu: capabilities: add QEMU_CAPS_VIRTFS_MULTIDEVS Christian Schoenebeck
2020-03-20 16:51 ` [PATCH v2 3/4] conf: add 'multidevs' option Christian Schoenebeck
2020-03-20 16:54 ` Christian Schoenebeck [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=db76c7042cf249ca51ef0269c824213eb73452b0.1584723663.git.qemu_oss@crudebyte.com \
--to=qemu_oss@crudebyte.com \
--cc=groug@kaod.org \
--cc=libvir-list@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).