[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [libvirt patch] qemu: adds support for virtfs 9p argume
From: |
Greg Kurz |
Subject: |
Re: [Qemu-devel] [libvirt patch] qemu: adds support for virtfs 9p argument 'vii' |
Date: |
Tue, 7 May 2019 11:55:56 +0200 |
On Mon, 06 May 2019 19:58:28 +0200
Christian Schoenebeck <address@hidden> wrote:
> This is the counter part patch against latest libvirt git master head to
Hmm... shouldn't this be Cc'd to address@hidden as well then ?
> support the 'vii' feature of patch 5, which introduces the XML config
What is patch 5 ?!? What is 'vii' ? I am a bit lost here...
> XML tag "important" on libvirt side.
>
> To stick with the previous example mentioned with patch 5, likewise
> libvirt XML configuration might then look like this:
>
> <domain type='kvm'>
> ...
> <devices>
> ...
> <filesystem type='mount' accessmode='mapped'>
> <source dir='/vm/fs'/>
> <target dir='root'/>
> <important path='/var/shares'/>
> <important path='/tmp'/>
> </filesystem>
> </devices>
> </domain>
>
> Like with the vii qemu virtfs command line argument, the order of the
> "important" tag defines which one gets the highest inode namespace
> (smallest generated suffix) on guest side.
>
> Signed-off-by: Christian Schoenebeck <address@hidden>
> ---
> docs/schemas/domaincommon.rng | 6 ++++++
> src/conf/domain_conf.c | 30 ++++++++++++++++++++++++++++++
> src/conf/domain_conf.h | 3 +++
> src/qemu/qemu_command.c | 10 ++++++++++
> 4 files changed, 49 insertions(+)
>
> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
> index 111b85c36f..c75edfc4d3 100644
> --- a/docs/schemas/domaincommon.rng
> +++ b/docs/schemas/domaincommon.rng
> @@ -2515,6 +2515,12 @@
> </choice>
> </attribute>
> </optional>
> + <zeroOrMore>
> + <element name='important'>
> + <attribute name="path"/>
> + <empty/>
> + </element>
> + </zeroOrMore>
> <optional>
> <element name='readonly'>
> <empty/>
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index b4fb6cf981..cc75c6a7dd 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -2294,6 +2294,8 @@ virDomainFSDefNew(void)
>
> void virDomainFSDefFree(virDomainFSDefPtr def)
> {
> + size_t i;
> +
> if (!def)
> return;
>
> @@ -2302,6 +2304,13 @@ void virDomainFSDefFree(virDomainFSDefPtr def)
> virDomainDeviceInfoClear(&def->info);
> VIR_FREE(def->virtio);
>
> + if (def->important) {
> + for (i = 0; i < def->nimportant; i++)
> + if (def->important[i])
> + VIR_FREE(def->important[i]);
> + }
> + VIR_FREE(def->important);
> +
> VIR_FREE(def);
> }
>
> @@ -10953,6 +10962,7 @@ virDomainFSDefParseXML(virDomainXMLOptionPtr xmlopt,
> VIR_AUTOFREE(char *) usage = NULL;
> VIR_AUTOFREE(char *) units = NULL;
> VIR_AUTOFREE(char *) model = NULL;
> + long n;
>
> ctxt->node = node;
>
> @@ -11001,6 +11011,12 @@ virDomainFSDefParseXML(virDomainXMLOptionPtr xmlopt,
> 1, ULLONG_MAX, false) < 0)
> goto error;
>
> + n = virXMLChildElementCount(node);
> + if (n > 0) {
> + if (VIR_ALLOC_N(def->important, n) < 0)
> + goto error;
> + }
> +
> cur = node->children;
> while (cur != NULL) {
> if (cur->type == XML_ELEMENT_NODE) {
> @@ -11039,6 +11055,8 @@ virDomainFSDefParseXML(virDomainXMLOptionPtr xmlopt,
>
> if (virDomainVirtioOptionsParseXML(cur, &def->virtio) < 0)
> goto error;
> + } else if (virXMLNodeNameEqual(cur, "important")) {
> + def->important[def->nimportant++] = virXMLPropString(cur,
> "path");
> }
> }
> cur = cur->next;
> @@ -11107,6 +11125,8 @@ virDomainFSDefParseXML(virDomainXMLOptionPtr xmlopt,
> goto error;
>
> cleanup:
> + if (def && def->important && !def->nimportant)
> + VIR_FREE(def->important);
> return def;
>
> error:
> @@ -24601,6 +24621,7 @@ virDomainFSDefFormat(virBufferPtr buf,
> const char *src = def->src->path;
> VIR_AUTOCLEAN(virBuffer) driverBuf = VIR_BUFFER_INITIALIZER;
> int ret = -1;
> + size_t i;
>
> if (!type) {
> virReportError(VIR_ERR_INTERNAL_ERROR,
> @@ -24689,6 +24710,15 @@ virDomainFSDefFormat(virBufferPtr buf,
> if (def->readonly)
> virBufferAddLit(buf, "<readonly/>\n");
>
> + if (def->important) {
> + for (i = 0; i < def->nimportant; ++i) {
> + if (!def->important[i]) continue;
> + virBufferAddLit(buf, "<important");
> + virBufferEscapeString(buf, " path='%s'", def->important[i]);
> + virBufferAddLit(buf, "/>\n");
> + }
> + }
> +
> if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0)
> goto cleanup;
>
> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index 01c22d8cc3..9bbd66d932 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -818,6 +818,9 @@ struct _virDomainFSDef {
> unsigned long long space_soft_limit; /* in bytes */
> bool symlinksResolved;
> virDomainVirtioOptionsPtr virtio;
> +
> + size_t nimportant;
> + char **important;
> };
>
>
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 50b4205267..2005ccadf8 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -2732,6 +2732,7 @@ qemuBuildFSStr(virDomainFSDefPtr fs)
> virBuffer opt = VIR_BUFFER_INITIALIZER;
> const char *driver = qemuDomainFSDriverTypeToString(fs->fsdriver);
> const char *wrpolicy = virDomainFSWrpolicyTypeToString(fs->wrpolicy);
> + size_t i;
>
> if (fs->type != VIR_DOMAIN_FS_TYPE_MOUNT) {
> virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> @@ -2775,6 +2776,15 @@ qemuBuildFSStr(virDomainFSDefPtr fs)
> if (fs->readonly)
> virBufferAddLit(&opt, ",readonly");
>
> + if (fs->important) {
> + for (i = 0; i < fs->nimportant; ++i) {
> + if (i == 0)
> + virBufferAsprintf(&opt, ",vii=%s", fs->important[i]);
> + else
> + virBufferAsprintf(&opt, ":%s", fs->important[i]);
> + }
> + }
> +
> if (virBufferCheckError(&opt) < 0)
> goto error;
>
- [Qemu-devel] [PATCH v3 0/5] 9p: Fix file ID collisions, Christian Schoenebeck, 2019/05/06
- [Qemu-devel] [PATCH v3 5/5] 9p: adds virtfs 'vii' device parameter, Christian Schoenebeck, 2019/05/06
- [Qemu-devel] [libvirt patch] qemu: adds support for virtfs 9p argument 'vii', Christian Schoenebeck, 2019/05/06
- Re: [Qemu-devel] [libvirt patch] qemu: adds support for virtfs 9p argument 'vii',
Greg Kurz <=
- Re: [Qemu-devel] [libvirt patch] qemu: adds support for virtfs 9p argument 'vii', Christian Schoenebeck, 2019/05/07
- Re: [Qemu-devel] [libvirt patch] qemu: adds support for virtfs 9p argument 'vii', Greg Kurz, 2019/05/07
- Re: [Qemu-devel] [libvirt patch] qemu: adds support for virtfs 9p argument 'vii', Christian Schoenebeck, 2019/05/07
- Re: [Qemu-devel] [libvirt patch] qemu: adds support for virtfs 9p argument 'vii', Christian Schoenebeck, 2019/05/17
- Re: [Qemu-devel] [libvirt patch] qemu: adds support for virtfs 9p argument 'vii', Greg Kurz, 2019/05/17
- Re: [Qemu-devel] [libvirt patch] qemu: adds support for virtfs 9p argument 'vii', Christian Schoenebeck, 2019/05/17
- Re: [Qemu-devel] [libvirt patch] qemu: adds support for virtfs 9p argument 'vii', Greg Kurz, 2019/05/17
- Re: [Qemu-devel] [libvirt patch] qemu: adds support for virtfs 9p argument 'vii', Christian Schoenebeck, 2019/05/17
- Re: [Qemu-devel] [libvirt patch] qemu: adds support for virtfs 9p argument 'vii', Greg Kurz, 2019/05/20
- Re: [Qemu-devel] [libvirt patch] qemu: adds support for virtfs 9p argument 'vii', Christian Schoenebeck, 2019/05/22