Add stat entries also for the mirror destination and the backup job
scratch/target file. This is possible with '-blockdev' as we use unique
index for the entries.
The stats are reported when the VIR_CONNECT_GET_ALL_DOMAINS_STATS_BACKING
is used.
Resolves:
https://bugzilla.redhat.com/show_bug.cgi?id=2017928
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_driver.c | 61 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 61 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 70b5f37e6b..7d13ae9754 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -113,6 +113,7 @@
#include "virdomaincheckpointobjlist.h"
#include "virsocket.h"
#include "virutil.h"
+#include "backup_conf.h"
#define VIR_FROM_THIS VIR_FROM_QEMU
@@ -18453,6 +18454,66 @@ qemuDomainGetStatsBlockExportDisk(virDomainDiskDef *disk,
break;
}
+ /* in blockdev mode where we can properly and uniquely identify images we
+ * can also report stats for the mirror target or the scratch image or target
+ * of a backup operation */
+ if (visitBacking && blockdev) {
+ qemuDomainObjPrivate *priv = dom->privateData;
+
+ if (disk->mirror &&
+ disk->mirrorJob == VIR_DOMAIN_BLOCK_JOB_TYPE_COPY) {
+ if (qemuDomainGetStatsBlockExportHeader(disk, disk->mirror, *recordnr,
params) < 0)
+ return -1;
+
+ if (qemuDomainGetStatsOneBlock(driver, cfg, dom, params,
+ disk->mirror->nodeformat,
+ disk->mirror,
+ *recordnr,
+ stats) < 0)
+ return -1;
+
+ if
(qemuDomainGetStatsBlockExportBackendStorage(disk->mirror->nodestorage,
+ stats, *recordnr,
+ params) < 0)
+ return -1;
+
+ (*recordnr)++;
+ }
+
+ if (priv->backup) {
+ size_t i;
+
+ for (i = 0; i < priv->backup->ndisks; i++) {
+ virDomainBackupDiskDef *backupdisk = priv->backup->disks + i;
+
+ if (STRNEQ(disk->dst, priv->backup->disks[i].name))
+ continue;
+
+ if (backupdisk->store) {
+ if (qemuDomainGetStatsBlockExportHeader(disk, backupdisk->store,
+ *recordnr, params) < 0)
+ return -1;
+
+ if (qemuDomainGetStatsOneBlock(driver, cfg, dom, params,
+ backupdisk->store->nodeformat,
+ backupdisk->store,
+ *recordnr,
+ stats) < 0)
+ return -1;
+
+ if
(qemuDomainGetStatsBlockExportBackendStorage(backupdisk->store->nodestorage,
+ stats, *recordnr,
+ params) < 0)
+ return -1;
+
+ (*recordnr)++;
+ }
+
+ break;
+ }
+ }
+ }
+
return 0;
}
--
2.31.1