Blob Blame History Raw
From 19acba61eef5c5caf17e5b75b4e2ea30458a18b3 Mon Sep 17 00:00:00 2001
Message-Id: <19acba61eef5c5caf17e5b75b4e2ea30458a18b3@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Fri, 28 Apr 2017 10:37:00 +0200
Subject: [PATCH] qemu: Don't fail if physical size can't be updated in
 qemuDomainGetBlockInfo

Since commit c5f6151390 qemuDomainBlockInfo tries to update the
"physical" storage size for all network storage and not only block
devices.

Since the storage driver APIs to do this are not implemented for certain
storage types (RBD, iSCSI, ...) the code would fail to retrieve any data
since the failure of qemuDomainStorageUpdatePhysical is fatal.

Since it's desired to return data even if the total size can't be
updated we need to ignore errors from that function and return plausible
data.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1442344
(cherry picked from commit 9f16bb7386939c400a7522d2489245f1e6831bae)

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/qemu/qemu_driver.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 3f3eca440..2fcf4612e 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -11567,10 +11567,12 @@ qemuDomainGetBlockInfo(virDomainPtr dom,
         if (info->allocation == 0)
             info->allocation = entry->physical;
 
-        if (qemuDomainStorageUpdatePhysical(driver, cfg, vm, disk->src) < 0)
-            goto endjob;
-
-        info->physical = disk->src->physical;
+        if (qemuDomainStorageUpdatePhysical(driver, cfg, vm, disk->src) == 0) {
+            info->physical = disk->src->physical;
+        } else {
+            virResetLastError();
+            info->physical = entry->physical;
+        }
     } else {
         info->physical = entry->physical;
     }
-- 
2.12.2