Re: [PATCH v3 2/5] xml: add disk driver metadata_cache_size option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 1/10/19 7:15 AM, Nikolay Shirokovskiy wrote:
> The options specifies metadata cache size policy for a disk.
> This is going to be used only for QEMU and only for qcow2 images in
> next patch to set qcow2 L2 cache size.
> 
> Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@xxxxxxxxxxxxx>
> ---
>  docs/formatdomain.html.in                          | 11 ++++++
>  docs/schemas/domaincommon.rng                      | 11 ++++++
>  src/conf/domain_conf.c                             | 17 +++++++++
>  src/conf/domain_conf.h                             |  9 +++++
>  .../qemuxml2argvdata/disk-metadata_cache_size.xml  | 35 ++++++++++++++++++
>  .../disk-metadata_cache_size.xml                   | 41 ++++++++++++++++++++++
>  tests/qemuxml2xmltest.c                            |  2 ++
>  7 files changed, 126 insertions(+)
>  create mode 100644 tests/qemuxml2argvdata/disk-metadata_cache_size.xml
>  create mode 100644 tests/qemuxml2xmloutdata/disk-metadata_cache_size.xml
> 
> diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
> index 7f07bb7..fcffa9c 100644
> --- a/docs/formatdomain.html.in
> +++ b/docs/formatdomain.html.in
> @@ -3608,6 +3608,17 @@
>              virt queues for virtio-blk. (<span class="since">Since 3.9.0</span>)
>            </li>
>            <li>
> +            The optional <code>metadata_cache_size</code> attribute specifies
> +            metadata cache size policy. Possible values are "default" and
> +            "maximum". Using "default" leaves setting cache size to the hypervisor,

Although "default" is possible for input, on output it's dropped.

> +            Using "maximum" ensures entire disk cache remains in memory, increasing
> +            IO but utilizing more memory. This policy helps if workload's
> +            disk working set (the amount of disk data used intensively) is too large
> +            to be covered by cache size by "default" policy.
> +            (<span class="since">Since 5.0.0, QEMU 3.0</span>). The option makes

The usage of the INT64_MAX doesn't happen until at least QEMU 3.1.  We
don't know when this will be supported though since -blockdev is
required and that's not yet in libvirt.

> +            sense only for non raw images and supported for qcow2 only now.
> +          </li>
> +          <li>
>            For virtio disks,
>            <a href="#elementsVirtio">Virtio-specific options</a> can also be
>            set. (<span class="since">Since 3.5.0</span>)
> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
> index aa50eac..aa8b8ff 100644
> --- a/docs/schemas/domaincommon.rng
> +++ b/docs/schemas/domaincommon.rng
> @@ -2003,6 +2003,9 @@
>          <ref name="detect_zeroes"/>
>        </optional>
>        <optional>
> +        <ref name="metadata_cache_size"/>
> +      </optional>
> +      <optional>
>          <attribute name='queues'>
>            <ref name="positiveInteger"/>
>          </attribute>
> @@ -2103,6 +2106,14 @@
>        </choice>
>      </attribute>
>    </define>
> +  <define name="metadata_cache_size">
> +    <attribute name='metadata_cache_size'>
> +      <choice>
> +        <value>default</value>
> +        <value>maximum</value>
> +      </choice>
> +    </attribute>
> +  </define>
>    <define name="controller">
>      <element name="controller">
>        <optional>
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 222bb8c..9488c35 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -889,6 +889,11 @@ VIR_ENUM_IMPL(virDomainDiskDetectZeroes, VIR_DOMAIN_DISK_DETECT_ZEROES_LAST,
>                "on",
>                "unmap")
>  
> +VIR_ENUM_IMPL(virDomainDiskMetadataCacheSize,
> +              VIR_DOMAIN_DISK_METADATA_CACHE_SIZE_LAST,
> +              "default",
> +              "maximum")
> +
>  VIR_ENUM_IMPL(virDomainDiskMirrorState, VIR_DOMAIN_DISK_MIRROR_STATE_LAST,
>                "none",
>                "yes",
> @@ -9419,6 +9424,14 @@ virDomainDiskDefDriverParseXML(virDomainDiskDefPtr def,
>      }
>      VIR_FREE(tmp);
>  
> +    if ((tmp = virXMLPropString(cur, "metadata_cache_size")) &&
> +        (def->metadata_cache_size = virDomainDiskMetadataCacheSizeTypeFromString(tmp)) < 0) {
> +        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> +                       _("unknown driver metadata_cache_size value '%s'"), tmp);
> +        goto cleanup;
> +    }
> +    VIR_FREE(tmp);
> +
>      ret = 0;
>  
>   cleanup:
> @@ -24193,6 +24206,10 @@ virDomainDiskDefFormatDriver(virBufferPtr buf,
>      if (disk->queues)
>          virBufferAsprintf(&driverBuf, " queues='%u'", disk->queues);
>  
> +    if (disk->metadata_cache_size)
> +        virBufferAsprintf(&driverBuf, " metadata_cache_size='%s'",
> +                          virDomainDiskMetadataCacheSizeTypeToString(disk->metadata_cache_size));
> +
>      virDomainVirtioOptionsFormat(&driverBuf, disk->virtio);
>  
>      return virXMLFormatElement(buf, "driver", &driverBuf, NULL);
> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index fae1306..31ce9ab 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -567,6 +567,13 @@ typedef enum {
>      VIR_DOMAIN_DISK_DETECT_ZEROES_LAST
>  } virDomainDiskDetectZeroes;
>  
> +typedef enum {
> +    VIR_DOMAIN_DISK_METADATA_CACHE_SIZE_DEFAULT = 0,

Because this is 0 that means supplying "default" in the XML is not
possible since the only way to Format the data is when
metadata_cache_size is present.

John

> +    VIR_DOMAIN_DISK_METADATA_CACHE_SIZE_MAXIMUM,
> +
> +    VIR_DOMAIN_DISK_METADATA_CACHE_SIZE_LAST
> +} virDomainDiskMetadataCacheSize;
> +


[...]

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux