From e50bf97d633e467750cae0f573bd1d1b398c8bc0 Mon Sep 17 00:00:00 2001
From: Pavel Hrdina <phrdina@redhat.com>
Date: Wed, 3 Feb 2021 16:28:40 +0100
Subject: [PATCH 087/108] qemu_driver: increase recorded counter for disk block
 stats

Commit <318d807a0bd3372b634d1952b559c5c627ccfa5b> added a fix to skip
most of the block stat code to not log error message for missing storage
sources but forgot to increase the recordnr counter.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 02ffd9909cf432b2aa52e5ae81beb188a372901d)
---
 src/qemu/qemu_driver.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 41e9bff17b..5f6543d8e8 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -21510,8 +21510,14 @@ qemuDomainGetStatsBlockExportDisk(virDomainDiskDefPtr disk,
         VIR_INFO("optional disk '%s' source file is missing, "
                  "skip getting stats", disk->dst);
 
-        return qemuDomainGetStatsBlockExportHeader(disk, disk->src, *recordnr,
-                                                   params);
+        if (qemuDomainGetStatsBlockExportHeader(disk, disk->src, *recordnr,
+                                                params) < 0) {
+            return -1;
+        }
+
+        (*recordnr)++;
+
+        return 0;
     }
 
     for (n = disk->src; virStorageSourceIsBacking(n); n = n->backingStore) {
-- 
2.33.0

