Re: [PATCHv2 10/15] xml: allow scaled memory on input

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

 



On 03/06/2012 01:34 AM, Eric Blake wrote:
Output is still in kibibytes, but input can now be in different
scales for ease of typing.

* src/conf/domain_conf.c (virDomainParseMemory): New helper.
(virDomainDefParseXML): Use it when parsing.
* docs/schemas/domaincommon.rng: Expand XML; rename memoryKBElement
to memoryElement and update callers.
* docs/formatdomain.html.in (elementsMemoryAllocation): Document
scaling.
* tests/qemuxml2argvdata/qemuxml2argv-memtune.xml: Adjust test.
* tests/qemuxml2xmltest.c: Likewise.
* tests/qemuxml2xmloutdata/qemuxml2xmlout-memtune.xml: New file.
---

v2: reuse code introduced earlier in series, add tests

  docs/formatdomain.html.in                          |   42 +++++++--
  docs/schemas/domaincommon.rng                      |   23 ++----
  src/conf/domain_conf.c                             |   93 +++++++++++++++----
  tests/qemuxml2argvdata/qemuxml2argv-memtune.xml    |    6 +-
  .../qemuxml2xmloutdata/qemuxml2xmlout-memtune.xml  |   31 +++++++
  tests/qemuxml2xmltest.c                            |    2 +-
  6 files changed, 147 insertions(+), 50 deletions(-)
  create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-memtune.xml

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 0855c7f..1e4a990 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -415,8 +415,8 @@
  <pre>
  &lt;domain&gt;
    ...
-&lt;memory&gt;524288&lt;/memory&gt;
-&lt;currentMemory&gt;524288&lt;/currentMemory&gt;
+&lt;memory unit='KiB'&gt;524288&lt;/memory&gt;
+&lt;currentMemory unit='KiB'&gt;524288&lt;/currentMemory&gt;
    ...
  &lt;/domain&gt;
  </pre>
@@ -424,12 +424,30 @@
      <dl>
        <dt><code>memory</code></dt>
        <dd>The maximum allocation of memory for the guest at boot time.
-        The units for this value are kibibytes (i.e. blocks of 1024 bytes)</dd>
+        The units for this value are determined by the optional
+        atttribute<code>unit</code>, which defaults to "KiB"
+        (kibibytes, 2<sup>10</sup>  or blocks of 1024 bytes).  Valid
+        units are "b" or "bytes" for bytes, "KB" for kilobytes
+        (10<sup>3</sup>  or 1,000), "k" or "KiB" for kibibytes (1024),
+        "MB" for megabytes (10<sup>6</sup>  or 1,000,000), "M" or "MiB"
+        for mebibytes (2<sup>20</sup>  or 1,048,576), "GB" for

As in the previous similar sections, I'd explicitly specify that the numbers are bytes here.

+        gigabytes (10<sup>9</sup>  or 1,000,000,000), "G" or "GiB" for
+        gibibytes (2<sup>30</sup>  or 1,073,741,824), "TB" for
+        terabytes (10<sup>12</sup>  or 1,000,000,000,000), or "T" or
+        "TiB" for tebibytes (2<sup>40</sup>  or 1,099,511,627,776).
+        However, the value will be rounded up to the nearest kibibyte
+        by libvirt, and may be further rounded to the granularity
+        supported by the hypervisor.  Some hypervisors also enforce a
+        minimum, such as

This patch clears everything I was afraid in 05/15.

ACK,

Peter

--
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]