render / rpms / libvirt

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