render / rpms / libvirt

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