Introduce new 'fmode' and 'dmode' options for filesystem. <filesystem type='mount' accessmode='mapped' fmode='644' dmode='755'> <source dir='/path'/> <target dir='mount_tag'> </filesystem> These options, when used with accessmode=mapped, set the creation mode for newly created files and directories (fmode and dmode, respectively) on the host. When not specified, QEMU defaults to 600 for files and 700 for directories. Signed-off-by: Brian Turek <brian.turek@xxxxxxxxx> --- docs/formatdomain.rst | 12 ++++ docs/schemas/domaincommon.rng | 16 +++++ src/conf/domain_conf.c | 43 +++++++++++++ src/conf/domain_conf.h | 2 + src/qemu/qemu_capabilities.c | 4 ++ src/qemu/qemu_capabilities.h | 2 + src/qemu/qemu_command.c | 6 ++ src/qemu/qemu_validate.c | 26 ++++++++ .../caps_2.10.0.aarch64.xml | 2 + .../caps_2.10.0.ppc64.xml | 2 + .../caps_2.10.0.s390x.xml | 2 + .../caps_2.10.0.x86_64.xml | 2 + .../caps_2.11.0.s390x.xml | 2 + .../caps_2.11.0.x86_64.xml | 2 + .../caps_2.12.0.aarch64.xml | 2 + .../caps_2.12.0.ppc64.xml | 2 + .../caps_2.12.0.s390x.xml | 2 + .../caps_2.12.0.x86_64.xml | 2 + .../qemucapabilitiesdata/caps_3.0.0.ppc64.xml | 2 + .../caps_3.0.0.riscv32.xml | 2 + .../caps_3.0.0.riscv64.xml | 2 + .../qemucapabilitiesdata/caps_3.0.0.s390x.xml | 2 + .../caps_3.0.0.x86_64.xml | 2 + .../qemucapabilitiesdata/caps_3.1.0.ppc64.xml | 2 + .../caps_3.1.0.x86_64.xml | 2 + .../caps_4.0.0.aarch64.xml | 2 + .../qemucapabilitiesdata/caps_4.0.0.ppc64.xml | 2 + .../caps_4.0.0.riscv32.xml | 2 + .../caps_4.0.0.riscv64.xml | 2 + .../qemucapabilitiesdata/caps_4.0.0.s390x.xml | 2 + .../caps_4.0.0.x86_64.xml | 2 + .../caps_4.1.0.x86_64.xml | 2 + .../caps_4.2.0.aarch64.xml | 2 + .../qemucapabilitiesdata/caps_4.2.0.ppc64.xml | 2 + .../qemucapabilitiesdata/caps_4.2.0.s390x.xml | 2 + .../caps_4.2.0.x86_64.xml | 2 + .../caps_5.0.0.aarch64.xml | 2 + .../qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 2 + .../caps_5.0.0.riscv64.xml | 2 + .../caps_5.0.0.x86_64.xml | 2 + .../caps_5.1.0.x86_64.xml | 2 + .../caps_5.2.0.x86_64.xml | 2 + .../virtio-9p-fmodedmode.x86_64-latest.args | 48 +++++++++++++++ .../qemuxml2argvdata/virtio-9p-fmodedmode.xml | 58 ++++++++++++++++++ .../virtio-9p-fmodedmode.x86_64-latest.xml | 61 +++++++++++++++++++ tests/qemuxml2xmltest.c | 1 + 46 files changed, 347 insertions(+) create mode 100644 tests/qemuxml2argvdata/virtio-9p-fmodedmode.x86_64-latest.args create mode 100644 tests/qemuxml2argvdata/virtio-9p-fmodedmode.xml create mode 100644 tests/qemuxml2xmloutdata/virtio-9p-fmodedmode.x86_64-latest.xml diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index f3cf9e1fb3..a98bf4948f 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -3062,6 +3062,12 @@ A directory on the host that can be accessed directly from the guest. <target dir='/import/from/host'/> <readonly/> </filesystem> + <filesystem type='mount' accessmode='mapped' fmode='644' dmode='755'> + <driver type='path'/> + <source dir='/export/to/guest'/> + <target dir='/import/from/host'/> + <readonly/> + </filesystem> <filesystem type='file' accessmode='passthrough'> <driver type='loop' format='raw'/> <driver type='path' wrpolicy='immediate'/> @@ -3141,6 +3147,12 @@ A directory on the host that can be accessed directly from the guest. "virtio-non-transitional", or "virtio". See `Virtio transitional devices <#elementsVirtioTransitional>`__ for more details. + :since:`Since 6.9.0`, the filesystem element has two optional attributes + ``fmode`` and ``dmode``. These two attributes control the creation mode for + files and directories when used with the ``mapped`` value for ``accessmode`` + (:since:`requires QEMU 2.10` ). If not specified, files are created with + mode ``600`` and directories with mode ``700``. + 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 ( diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 4b7e460148..78b9f0c750 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -26,6 +26,12 @@ </element> </define> + <define name='createMode'> + <data type="unsignedInt"> + <param name='pattern'>[0-7]{1,3}</param> + </data> + </define> + <!-- We handle only document defining a domain --> @@ -2736,6 +2742,16 @@ </choice> </attribute> </optional> + <optional> + <attribute name="fmode"> + <ref name='createMode'/> + </attribute> + </optional> + <optional> + <attribute name="dmode"> + <ref name='createMode'/> + </attribute> + </optional> <optional> <element name='readonly'> <empty/> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index a91dbd4aa9..5c3d71f31e 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -11507,6 +11507,8 @@ virDomainFSDefParseXML(virDomainXMLOptionPtr xmlopt, g_autofree char *units = NULL; g_autofree char *model = NULL; g_autofree char *multidevs = NULL; + g_autofree char *fmode = NULL; + g_autofree char *dmode = NULL; ctxt->node = node; @@ -11535,6 +11537,40 @@ virDomainFSDefParseXML(virDomainXMLOptionPtr xmlopt, def->accessmode = VIR_DOMAIN_FS_ACCESSMODE_PASSTHROUGH; } + fmode = virXMLPropString(node, "fmode"); + if (fmode) { + if (def->accessmode != VIR_DOMAIN_FS_ACCESSMODE_MAPPED) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("fmode must be used with accessmode=mapped")); + goto error; + } + + if (virStrToLong_uip(fmode, NULL, 10, &def->fmode) < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("invalid fmode: '%s'"), fmode); + goto error; + } + } else { + def->fmode = 0; + } + + dmode = virXMLPropString(node, "dmode"); + if (dmode) { + if (def->accessmode != VIR_DOMAIN_FS_ACCESSMODE_MAPPED) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("dmode must be used with accessmode=mapped")); + goto error; + } + + if (virStrToLong_uip(dmode, NULL, 10, &def->dmode) < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("invalid dmode: '%s'"), dmode); + goto error; + } + } else { + def->dmode = 0; + } + model = virXMLPropString(node, "model"); if (model) { if ((def->model = virDomainFSModelTypeFromString(model)) < 0 || @@ -26123,6 +26159,13 @@ virDomainFSDefFormat(virBufferPtr buf, } if (def->multidevs) virBufferAsprintf(buf, " multidevs='%s'", multidevs); + + if (def->fmode) + virBufferAsprintf(buf, " fmode='%03d'", def->fmode); + + if (def->dmode) + virBufferAsprintf(buf, " dmode='%03d'", def->dmode); + virBufferAddLit(buf, ">\n"); virBufferAdjustIndent(buf, 2); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 8f1662aae0..fabc8c2e56 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -849,6 +849,8 @@ struct _virDomainFSDef { int wrpolicy; /* enum virDomainFSWrpolicy */ int format; /* virStorageFileFormat */ int model; /* virDomainFSModel */ + unsigned int fmode; + unsigned int dmode; int multidevs; /* virDomainFSMultidevs */ unsigned long long usage; /* in bytes */ virStorageSourcePtr src; diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 5dcfcd574d..b66fc65444 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -600,6 +600,8 @@ VIR_ENUM_IMPL(virQEMUCaps, /* 380 */ "usb-host.hostdevice", + "fsdev.fmode", + "fsdev.dmode", ); @@ -3334,6 +3336,8 @@ static struct virQEMUCapsCommandLineProps virQEMUCapsCommandLine[] = { { "smp-opts", "dies", QEMU_CAPS_SMP_DIES }, { "fsdev", "multidevs", QEMU_CAPS_FSDEV_MULTIDEVS }, { "fw_cfg", "file", QEMU_CAPS_FW_CFG }, + { "fsdev", "fmode", QEMU_CAPS_FSDEV_FMODE }, + { "fsdev", "dmode", QEMU_CAPS_FSDEV_DMODE }, }; static int diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 98d70cfa0e..1349625508 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -580,6 +580,8 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ /* 380 */ QEMU_CAPS_USB_HOST_HOSTDEVICE, /* -device usb-host.hostdevice */ + QEMU_CAPS_FSDEV_FMODE, /* fsdev.fmode */ + QEMU_CAPS_FSDEV_DMODE, /* fsdev.dmode */ QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index e9ba81d82f..1d70937d4e 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2275,6 +2275,12 @@ qemuBuildFSStr(virDomainFSDefPtr fs) } else if (fs->multidevs == VIR_DOMAIN_FS_MULTIDEVS_WARN) { virBufferAddLit(&opt, ",multidevs=warn"); } + if (fs->fmode) { + virBufferAsprintf(&opt, ",fmode=%03d", fs->fmode); + } + if (fs->dmode) { + virBufferAsprintf(&opt, ",dmode=%03d", fs->dmode); + } } 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_validate.c b/src/qemu/qemu_validate.c index a212605579..37a1fa9528 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -3530,6 +3530,22 @@ qemuValidateDomainDeviceDefFS(virDomainFSDefPtr fs, return -1; } + if (fs->fmode && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_FSDEV_FMODE)) + { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("fmode is not supported with this QEMU binary")); + return -1; + } + + if (fs->dmode && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_FSDEV_DMODE)) + { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("dmode is not supported with this QEMU binary")); + return -1; + } + switch ((virDomainFSDriverType) fs->fsdriver) { case VIR_DOMAIN_FS_DRIVER_TYPE_DEFAULT: case VIR_DOMAIN_FS_DRIVER_TYPE_PATH: @@ -3591,6 +3607,16 @@ qemuValidateDomainDeviceDefFS(virDomainFSDefPtr fs, _("virtiofs does not support multidevs")); return -1; } + if (fs->fmode) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("virtiofs does not support fmode")); + return -1; + } + if (fs->dmode) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("virtiofs does not support dmode")); + return -1; + } if (qemuValidateDomainDefVirtioFSSharedMemory(def) < 0) return -1; break; diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml index b0fcbc4218..d38634af74 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml @@ -145,6 +145,8 @@ <flag name='fw_cfg'/> <flag name='migration-param.bandwidth'/> <flag name='migration-param.downtime'/> + <flag name='fsdev.fmode'/> + <flag name='fsdev.dmode'/> <version>2010000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>61700287</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml index edf01d2e2f..844cc1b013 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml @@ -145,6 +145,8 @@ <flag name='fw_cfg'/> <flag name='migration-param.bandwidth'/> <flag name='migration-param.downtime'/> + <flag name='fsdev.fmode'/> + <flag name='fsdev.dmode'/> <version>2010000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>42900287</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml b/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml index 98a3c0eec2..8038c0b136 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml @@ -111,6 +111,8 @@ <flag name='fw_cfg'/> <flag name='migration-param.bandwidth'/> <flag name='migration-param.downtime'/> + <flag name='fsdev.fmode'/> + <flag name='fsdev.dmode'/> <version>2010000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>39100287</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml index 98b1a94349..92fddd8393 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml @@ -189,6 +189,8 @@ <flag name='fw_cfg'/> <flag name='migration-param.bandwidth'/> <flag name='migration-param.downtime'/> + <flag name='fsdev.fmode'/> + <flag name='fsdev.dmode'/> <version>2010000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100287</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml b/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml index 0391f4b81e..e4aba0317d 100644 --- a/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml @@ -119,6 +119,8 @@ <flag name='migration-param.bandwidth'/> <flag name='migration-param.downtime'/> <flag name='migration-param.xbzrle-cache-size'/> + <flag name='fsdev.fmode'/> + <flag name='fsdev.dmode'/> <version>2011000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>39100288</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_2.11.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.11.0.x86_64.xml index 9eaafb4ba6..896b9ad51f 100644 --- a/tests/qemucapabilitiesdata/caps_2.11.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.11.0.x86_64.xml @@ -196,6 +196,8 @@ <flag name='migration-param.bandwidth'/> <flag name='migration-param.downtime'/> <flag name='migration-param.xbzrle-cache-size'/> + <flag name='fsdev.fmode'/> + <flag name='fsdev.dmode'/> <version>2011000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100288</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml index a5d6dc3bef..0ede9b43b4 100644 --- a/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml @@ -162,6 +162,8 @@ <flag name='migration-param.bandwidth'/> <flag name='migration-param.downtime'/> <flag name='migration-param.xbzrle-cache-size'/> + <flag name='fsdev.fmode'/> + <flag name='fsdev.dmode'/> <version>2012000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>61700289</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml index d1ed9f6e28..df0ab8840a 100644 --- a/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml @@ -163,6 +163,8 @@ <flag name='migration-param.bandwidth'/> <flag name='migration-param.downtime'/> <flag name='migration-param.xbzrle-cache-size'/> + <flag name='fsdev.fmode'/> + <flag name='fsdev.dmode'/> <version>2011090</version> <kvmVersion>0</kvmVersion> <microcodeVersion>42900289</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml b/tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml index cef6ebb9ad..cee420e71f 100644 --- a/tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml @@ -131,6 +131,8 @@ <flag name='migration-param.bandwidth'/> <flag name='migration-param.downtime'/> <flag name='migration-param.xbzrle-cache-size'/> + <flag name='fsdev.fmode'/> + <flag name='fsdev.dmode'/> <version>2012000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>39100289</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml index 6d48699e3e..a81d7992bb 100644 --- a/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml @@ -206,6 +206,8 @@ <flag name='migration-param.bandwidth'/> <flag name='migration-param.downtime'/> <flag name='migration-param.xbzrle-cache-size'/> + <flag name='fsdev.fmode'/> + <flag name='fsdev.dmode'/> <version>2011090</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100289</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_3.0.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_3.0.0.ppc64.xml index e4a560bac5..a005c50771 100644 --- a/tests/qemucapabilitiesdata/caps_3.0.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_3.0.0.ppc64.xml @@ -165,6 +165,8 @@ <flag name='migration-param.bandwidth'/> <flag name='migration-param.downtime'/> <flag name='migration-param.xbzrle-cache-size'/> + <flag name='fsdev.fmode'/> + <flag name='fsdev.dmode'/> <version>2012050</version> <kvmVersion>0</kvmVersion> <microcodeVersion>42900239</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_3.0.0.riscv32.xml b/tests/qemucapabilitiesdata/caps_3.0.0.riscv32.xml index 71f9b0c37f..51d952c9f8 100644 --- a/tests/qemucapabilitiesdata/caps_3.0.0.riscv32.xml +++ b/tests/qemucapabilitiesdata/caps_3.0.0.riscv32.xml @@ -101,6 +101,8 @@ <flag name='migration-param.bandwidth'/> <flag name='migration-param.downtime'/> <flag name='migration-param.xbzrle-cache-size'/> + <flag name='fsdev.fmode'/> + <flag name='fsdev.dmode'/> <version>3000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>0</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_3.0.0.riscv64.xml b/tests/qemucapabilitiesdata/caps_3.0.0.riscv64.xml index 279078d541..12f5ae4261 100644 --- a/tests/qemucapabilitiesdata/caps_3.0.0.riscv64.xml +++ b/tests/qemucapabilitiesdata/caps_3.0.0.riscv64.xml @@ -101,6 +101,8 @@ <flag name='migration-param.bandwidth'/> <flag name='migration-param.downtime'/> <flag name='migration-param.xbzrle-cache-size'/> + <flag name='fsdev.fmode'/> + <flag name='fsdev.dmode'/> <version>3000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>0</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_3.0.0.s390x.xml b/tests/qemucapabilitiesdata/caps_3.0.0.s390x.xml index f1ed34c612..a9c859d90e 100644 --- a/tests/qemucapabilitiesdata/caps_3.0.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_3.0.0.s390x.xml @@ -134,6 +134,8 @@ <flag name='migration-param.bandwidth'/> <flag name='migration-param.downtime'/> <flag name='migration-param.xbzrle-cache-size'/> + <flag name='fsdev.fmode'/> + <flag name='fsdev.dmode'/> <version>3000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>39100239</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml index ae1836b28f..b22f3122eb 100644 --- a/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml @@ -212,6 +212,8 @@ <flag name='migration-param.bandwidth'/> <flag name='migration-param.downtime'/> <flag name='migration-param.xbzrle-cache-size'/> + <flag name='fsdev.fmode'/> + <flag name='fsdev.dmode'/> <version>3000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100239</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_3.1.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_3.1.0.ppc64.xml index 0dc0393c22..e5408fbc93 100644 --- a/tests/qemucapabilitiesdata/caps_3.1.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_3.1.0.ppc64.xml @@ -170,6 +170,8 @@ <flag name='migration-param.bandwidth'/> <flag name='migration-param.downtime'/> <flag name='migration-param.xbzrle-cache-size'/> + <flag name='fsdev.fmode'/> + <flag name='fsdev.dmode'/> <version>3000091</version> <kvmVersion>0</kvmVersion> <microcodeVersion>42900240</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_3.1.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_3.1.0.x86_64.xml index d4ff21fdac..5637610c40 100644 --- a/tests/qemucapabilitiesdata/caps_3.1.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_3.1.0.x86_64.xml @@ -215,6 +215,8 @@ <flag name='migration-param.bandwidth'/> <flag name='migration-param.downtime'/> <flag name='migration-param.xbzrle-cache-size'/> + <flag name='fsdev.fmode'/> + <flag name='fsdev.dmode'/> <version>3000092</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100240</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_4.0.0.aarch64.xml index 404a39af03..ff346eaca9 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.aarch64.xml @@ -176,6 +176,8 @@ <flag name='migration-param.bandwidth'/> <flag name='migration-param.downtime'/> <flag name='migration-param.xbzrle-cache-size'/> + <flag name='fsdev.fmode'/> + <flag name='fsdev.dmode'/> <version>4000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>61700240</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_4.0.0.ppc64.xml index cb0232173c..3bfd31f895 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.ppc64.xml @@ -184,6 +184,8 @@ <flag name='migration-param.bandwidth'/> <flag name='migration-param.downtime'/> <flag name='migration-param.xbzrle-cache-size'/> + <flag name='fsdev.fmode'/> + <flag name='fsdev.dmode'/> <version>4000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>42900240</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.riscv32.xml b/tests/qemucapabilitiesdata/caps_4.0.0.riscv32.xml index 11475306f9..53ec65a286 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.riscv32.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.riscv32.xml @@ -177,6 +177,8 @@ <flag name='migration-param.bandwidth'/> <flag name='migration-param.downtime'/> <flag name='migration-param.xbzrle-cache-size'/> + <flag name='fsdev.fmode'/> + <flag name='fsdev.dmode'/> <version>4000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>0</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.riscv64.xml b/tests/qemucapabilitiesdata/caps_4.0.0.riscv64.xml index 608590a35b..ebd73f2e5e 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.riscv64.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.riscv64.xml @@ -177,6 +177,8 @@ <flag name='migration-param.bandwidth'/> <flag name='migration-param.downtime'/> <flag name='migration-param.xbzrle-cache-size'/> + <flag name='fsdev.fmode'/> + <flag name='fsdev.dmode'/> <version>4000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>0</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.s390x.xml b/tests/qemucapabilitiesdata/caps_4.0.0.s390x.xml index f4d20169e0..3789d89f8f 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.s390x.xml @@ -142,6 +142,8 @@ <flag name='migration-param.bandwidth'/> <flag name='migration-param.downtime'/> <flag name='migration-param.xbzrle-cache-size'/> + <flag name='fsdev.fmode'/> + <flag name='fsdev.dmode'/> <version>4000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>39100240</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml index e3f83372c2..a8720943f0 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml @@ -221,6 +221,8 @@ <flag name='migration-param.downtime'/> <flag name='migration-param.xbzrle-cache-size'/> <flag name='intel-iommu.aw-bits'/> + <flag name='fsdev.fmode'/> + <flag name='fsdev.dmode'/> <version>4000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100240</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml index c32d8ea5d8..d36519d4c9 100644 --- a/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml @@ -227,6 +227,8 @@ <flag name='migration-param.downtime'/> <flag name='migration-param.xbzrle-cache-size'/> <flag name='intel-iommu.aw-bits'/> + <flag name='fsdev.fmode'/> + <flag name='fsdev.dmode'/> <version>4001000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100241</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml index 11a964ed39..af73e0fa7d 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml @@ -189,6 +189,8 @@ <flag name='migration-param.downtime'/> <flag name='migration-param.xbzrle-cache-size'/> <flag name='blockdev-hostdev-scsi'/> + <flag name='fsdev.fmode'/> + <flag name='fsdev.dmode'/> <version>4001050</version> <kvmVersion>0</kvmVersion> <microcodeVersion>61700242</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml index 60aef01f7b..166735b90a 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml @@ -190,6 +190,8 @@ <flag name='migration-param.downtime'/> <flag name='migration-param.xbzrle-cache-size'/> <flag name='spapr-tpm-proxy'/> + <flag name='fsdev.fmode'/> + <flag name='fsdev.dmode'/> <version>4001050</version> <kvmVersion>0</kvmVersion> <microcodeVersion>42900242</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml b/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml index 76e2747b65..8d89421c48 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml @@ -153,6 +153,8 @@ <flag name='migration-param.downtime'/> <flag name='migration-param.xbzrle-cache-size'/> <flag name='blockdev-hostdev-scsi'/> + <flag name='fsdev.fmode'/> + <flag name='fsdev.dmode'/> <version>4002000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>39100242</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml index fd63a0ee02..b425d87751 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml @@ -236,6 +236,8 @@ <flag name='migration-param.xbzrle-cache-size'/> <flag name='intel-iommu.aw-bits'/> <flag name='blockdev-hostdev-scsi'/> + <flag name='fsdev.fmode'/> + <flag name='fsdev.dmode'/> <version>4002000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100242</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml index 928af2a01c..6ccba3ac71 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml @@ -199,6 +199,8 @@ <flag name='migration-param.xbzrle-cache-size'/> <flag name='numa.hmat'/> <flag name='blockdev-hostdev-scsi'/> + <flag name='fsdev.fmode'/> + <flag name='fsdev.dmode'/> <version>5000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>61700241</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml index e8668a25a9..9d06378878 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml @@ -208,6 +208,8 @@ <flag name='spapr-tpm-proxy'/> <flag name='numa.hmat'/> <flag name='blockdev-hostdev-scsi'/> + <flag name='fsdev.fmode'/> + <flag name='fsdev.dmode'/> <version>5000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>42900241</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml b/tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml index 85a8a46dac..00b5c1ee87 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml @@ -195,6 +195,8 @@ <flag name='migration-param.xbzrle-cache-size'/> <flag name='numa.hmat'/> <flag name='blockdev-hostdev-scsi'/> + <flag name='fsdev.fmode'/> + <flag name='fsdev.dmode'/> <version>5000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>0</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml index 546b9b0422..25936b30db 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml @@ -243,6 +243,8 @@ <flag name='intel-iommu.aw-bits'/> <flag name='numa.hmat'/> <flag name='blockdev-hostdev-scsi'/> + <flag name='fsdev.fmode'/> + <flag name='fsdev.dmode'/> <version>5000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100241</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml index 987beb965e..a30323c858 100644 --- a/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml @@ -243,6 +243,8 @@ <flag name='numa.hmat'/> <flag name='blockdev-hostdev-scsi'/> <flag name='usb-host.hostdevice'/> + <flag name='fsdev.fmode'/> + <flag name='fsdev.dmode'/> <version>5001000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100242</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml index 3ee678ef8f..02dc78d838 100644 --- a/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml @@ -243,6 +243,8 @@ <flag name='numa.hmat'/> <flag name='blockdev-hostdev-scsi'/> <flag name='usb-host.hostdevice'/> + <flag name='fsdev.fmode'/> + <flag name='fsdev.dmode'/> <version>5001050</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100243</microcodeVersion> diff --git a/tests/qemuxml2argvdata/virtio-9p-fmodedmode.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-9p-fmodedmode.x86_64-latest.args new file mode 100644 index 0000000000..666d53307a --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-9p-fmodedmode.x86_64-latest.args @@ -0,0 +1,48 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/tmp/lib/domain--1-QEMUGuest1 \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-x86_64 \ +-name guest=QEMUGuest1,debug-threads=on \ +-S \ +-object secret,id=masterKey0,format=raw,\ +file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ +-machine pc,accel=tcg,usb=off,dump-guest-core=off \ +-cpu qemu64 \ +-m 214 \ +-overcommit mem-lock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,fd=1729,server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-boot strict=on \ +-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ +-fsdev local,security_model=mapped,fmode=644,id=fsdev-fs0,\ +path=/export/fs0 \ +-device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=fs0,bus=pci.0,addr=0x2 \ +-fsdev local,security_model=mapped,dmoe=755,id=fsdev-fs1,\ +path=/export/fs1 \ +-device virtio-9p-pci,id=fs1,fsdev=fsdev-fs1,mount_tag=fs1,bus=pci.0,addr=0x3 \ +-fsdev local,security_model=mapped,fmode=644,dmode=755,id=fsdev-fs2,\ +path=/export/fs2 \ +-device virtio-9p-pci,id=fs2,fsdev=fsdev-fs2,mount_tag=fs2,bus=pci.0,addr=0x4 \ +-chardev pty,id=charserial0 \ +-fsdev local,security_model=mapped,id=fsdev-fs3,\ +path=/export/fs2 \ +-device virtio-9p-pci,id=fs3,fsdev=fsdev-fs3,mount_tag=fs3,bus=pci.0,addr=0x5 \ +-device isa-serial,chardev=charserial0,id=serial0 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0xc \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ +resourcecontrol=deny \ +-msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-9p-fmodedmode.xml b/tests/qemuxml2argvdata/virtio-9p-fmodedmode.xml new file mode 100644 index 0000000000..bca9db02ad --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-9p-fmodedmode.xml @@ -0,0 +1,58 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> + <filesystem type='mount' accessmode='mapped' fmode='644'> + <source dir='/export/fs0'/> + <target dir='fs0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </filesystem> + <filesystem type='mount' accessmode='mapped' dmode='755'> + <source dir='/export/fs1'/> + <target dir='fs1'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </filesystem> + <filesystem type='mount' accessmode='mapped' fmode='640' dmode='750'> + <source dir='/export/fs2'/> + <target dir='fs2'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </filesystem> + <filesystem type='mount' accessmode='mapped'> + <source dir='/export/fs3'/> + <target dir='fs3'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> + </filesystem> + <serial type='pty'> + <target type='isa-serial' port='0'> + <model name='isa-serial'/> + </target> + </serial> + <console type='pty'> + <target type='serial' port='0'/> + </console> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x0c' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2xmloutdata/virtio-9p-fmodedmode.x86_64-latest.xml b/tests/qemuxml2xmloutdata/virtio-9p-fmodedmode.x86_64-latest.xml new file mode 100644 index 0000000000..a119c0a9a6 --- /dev/null +++ b/tests/qemuxml2xmloutdata/virtio-9p-fmodedmode.x86_64-latest.xml @@ -0,0 +1,61 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> + </cpu> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='usb' index='0' model='piix3-uhci'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> + <filesystem type='mount' accessmode='mapped' fmode='644'> + <source dir='/export/fs0'/> + <target dir='fs0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </filesystem> + <filesystem type='mount' accessmode='mapped' dmode='755'> + <source dir='/export/fs1'/> + <target dir='fs1'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </filesystem> + <filesystem type='mount' accessmode='mapped' fmode='640' dmode='750'> + <source dir='/export/fs2'/> + <target dir='fs2'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </filesystem> + <filesystem type='mount' accessmode='mapped'> + <source dir='/export/fs3'/> + <target dir='fs3'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> + </filesystem> + <serial type='pty'> + <target type='isa-serial' port='0'> + <model name='isa-serial'/> + </target> + </serial> + <console type='pty'> + <target type='serial' port='0'/> + </console> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x0c' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 2bf8dd5b14..855720adb9 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1496,6 +1496,7 @@ mymain(void) DO_TEST_CAPS_ARCH_LATEST("x86_64-default-cpu-tcg-q35-4.2", "x86_64"); DO_TEST_CAPS_LATEST("virtio-9p-multidevs"); + DO_TEST_CAPS_LATEST("virtio-9p-fmodedmode"); DO_TEST("downscript", NONE); cleanup: -- 2.25.1