]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: Display <physical> in output of voldef
authorJohn Ferlan <jferlan@redhat.com>
Tue, 13 Dec 2016 15:56:21 +0000 (10:56 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Tue, 20 Dec 2016 18:52:39 +0000 (13:52 -0500)
Although the virStorageBackendUpdateVolTargetInfo will update the
target.physical value, there is no way to provide that information
via the virStorageGetVolInfo API since it only returns the capacity
and allocation of a volume. So as described in commit id '0282ca45',
it should be possible to generate an output only <physical> value
for that purpose.

This patch generates the <physical> value in the volume XML output
for the sole purpose of being able to view/see the value to allow
someone to parse the XML in order to obtain the value.

Update the documentation to describe the output only nature.

Signed-off-by: John Ferlan <jferlan@redhat.com>
docs/formatstorage.html.in
src/conf/storage_conf.c

index 47c8b0c8a7a075d545aae0c69ea1f964f6952429..a7273ed78e6dec0a0e6406255394e7edcda25339 100644 (file)
         specified with the same semantics as for <code>allocation</code>
         This is compulsory when creating a volume.
         <span class="since">Since 0.4.1</span></dd>
+      <dt><code>physical</code></dt>
+      <dd>This output only element provides the host physical size of
+        the target storage volume. The default output <code>unit</code>
+        will be in bytes.
+        <span class="since">Since 3.0.0</span></dd>
       <dt><code>source</code></dt>
       <dd>Provides information about the underlying storage allocation
         of the volume. This may not be available for some pool types.
index 7e7bb7239e552e9f9f804567875487d0d39aa641..71ea0c9960240a602f13725c80fc15df370f3c38 100644 (file)
@@ -1669,6 +1669,12 @@ virStorageVolDefFormat(virStoragePoolDefPtr pool,
                       def->target.capacity);
     virBufferAsprintf(&buf, "<allocation unit='bytes'>%llu</allocation>\n",
                       def->target.allocation);
+    /* NB: Display only - since virStorageVolInfo is limited to just
+     * 'capacity' and 'allocation' on output. Since we don't read this
+     * in, be sure it was filled in before printing */
+    if (def->target.physical)
+        virBufferAsprintf(&buf, "<physical unit='bytes'>%llu</physical>\n",
+                          def->target.physical);
 
     if (virStorageVolTargetDefFormat(options, &buf,
                                      &def->target, "target") < 0)