From 78661cb1f45742f27430b2629056f0397ceb2fd2 Mon Sep 17 00:00:00 2001 From: John Ferlan Date: Tue, 13 Dec 2016 10:56:21 -0500 Subject: [PATCH] conf: Display in output of voldef 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 value for that purpose. This patch generates the 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 --- docs/formatstorage.html.in | 5 +++++ src/conf/storage_conf.c | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/docs/formatstorage.html.in b/docs/formatstorage.html.in index 47c8b0c8a7..a7273ed78e 100644 --- a/docs/formatstorage.html.in +++ b/docs/formatstorage.html.in @@ -550,6 +550,11 @@ specified with the same semantics as for allocation This is compulsory when creating a volume. Since 0.4.1 +
physical
+
This output only element provides the host physical size of + the target storage volume. The default output unit + will be in bytes. + Since 3.0.0
source
Provides information about the underlying storage allocation of the volume. This may not be available for some pool types. diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index 7e7bb7239e..71ea0c9960 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -1669,6 +1669,12 @@ virStorageVolDefFormat(virStoragePoolDefPtr pool, def->target.capacity); virBufferAsprintf(&buf, "%llu\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, "%llu\n", + def->target.physical); if (virStorageVolTargetDefFormat(options, &buf, &def->target, "target") < 0) -- 2.39.5