Blame SOURCES/libvirt-qemuBlockStorageSourceGetBackendProps-Report-errors-on-all-switch-cases.patch

d76c62
From d08dae3e94778cf5860b6bd7b34bfbdc4741464c Mon Sep 17 00:00:00 2001
d76c62
Message-Id: <d08dae3e94778cf5860b6bd7b34bfbdc4741464c@dist-git>
d76c62
From: Peter Krempa <pkrempa@redhat.com>
d76c62
Date: Wed, 19 Feb 2020 15:09:52 +0100
d76c62
Subject: [PATCH] qemuBlockStorageSourceGetBackendProps: Report errors on all
d76c62
 switch cases
d76c62
MIME-Version: 1.0
d76c62
Content-Type: text/plain; charset=UTF-8
d76c62
Content-Transfer-Encoding: 8bit
d76c62
d76c62
Few switch cases returned failure but didn't report an error. For a
d76c62
situation when the backingStore type='volume' was not translated the
d76c62
following error would occur:
d76c62
d76c62
 $ virsh start VM
d76c62
 error: Failed to start domain VM
d76c62
 error: An error occurred, but the cause is unknown
d76c62
d76c62
After this patch:
d76c62
d76c62
 $ virsh start VM
d76c62
 error: Failed to start domain VM
d76c62
 error: internal error: storage source pool 'tmp' volume 'pull3.qcow2' is not translated
d76c62
d76c62
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
d76c62
Reviewed-by: Erik Skultety <eskultet@redhat.com>
d76c62
Reviewed-by: Ján Tomko <jtomko@redhat.com>
d76c62
(cherry picked from commit 4e3e69fed45ac58bf19ebbe910213cb552d51f01)
d76c62
https://bugzilla.redhat.com/show_bug.cgi?id=1804603
d76c62
Message-Id: <43cca40afafd5de0aad1f477d63b21d1b10ba796.1582120424.git.pkrempa@redhat.com>
d76c62
Reviewed-by: Ján Tomko <jtomko@redhat.com>
d76c62
---
d76c62
 src/qemu/qemu_block.c | 7 +++++++
d76c62
 1 file changed, 7 insertions(+)
d76c62
d76c62
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
d76c62
index 63116ef5f2..0ee10dd770 100644
d76c62
--- a/src/qemu/qemu_block.c
d76c62
+++ b/src/qemu/qemu_block.c
d76c62
@@ -1081,8 +1081,14 @@ qemuBlockStorageSourceGetBackendProps(virStorageSourcePtr src,
d76c62
         break;
d76c62
 
d76c62
     case VIR_STORAGE_TYPE_VOLUME:
d76c62
+        virReportError(VIR_ERR_INTERNAL_ERROR,
d76c62
+                       _("storage source pool '%s' volume '%s' is not translated"),
d76c62
+                       src->srcpool->pool, src->srcpool->volume);
d76c62
+        return NULL;
d76c62
+
d76c62
     case VIR_STORAGE_TYPE_NONE:
d76c62
     case VIR_STORAGE_TYPE_LAST:
d76c62
+        virReportEnumRangeError(virStorageType, actualType);
d76c62
         return NULL;
d76c62
 
d76c62
     case VIR_STORAGE_TYPE_NETWORK:
d76c62
@@ -1141,6 +1147,7 @@ qemuBlockStorageSourceGetBackendProps(virStorageSourcePtr src,
d76c62
 
d76c62
         case VIR_STORAGE_NET_PROTOCOL_NONE:
d76c62
         case VIR_STORAGE_NET_PROTOCOL_LAST:
d76c62
+            virReportEnumRangeError(virStorageNetProtocol, src->protocol);
d76c62
             return NULL;
d76c62
         }
d76c62
         break;
d76c62
-- 
d76c62
2.25.0
d76c62