[PATCH] qemuBlockStorageSourceGetBackendProps: Report errors on all switch cases

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Few switch cases returned failure but didn't report an error. For a
situation when the backingStore type='volume' was not translated the
following error would occur:

 $ virsh start VM
 error: Failed to start domain VM
 error: An error occurred, but the cause is unknown

After this patch:

 $ virsh start VM
 error: Failed to start domain VM
 error: internal error: storage source pool 'tmp' volume 'pull3.qcow2' is not translated

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_block.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 63116ef5f2..0ee10dd770 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -1081,8 +1081,14 @@ qemuBlockStorageSourceGetBackendProps(virStorageSourcePtr src,
         break;

     case VIR_STORAGE_TYPE_VOLUME:
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("storage source pool '%s' volume '%s' is not translated"),
+                       src->srcpool->pool, src->srcpool->volume);
+        return NULL;
+
     case VIR_STORAGE_TYPE_NONE:
     case VIR_STORAGE_TYPE_LAST:
+        virReportEnumRangeError(virStorageType, actualType);
         return NULL;

     case VIR_STORAGE_TYPE_NETWORK:
@@ -1141,6 +1147,7 @@ qemuBlockStorageSourceGetBackendProps(virStorageSourcePtr src,

         case VIR_STORAGE_NET_PROTOCOL_NONE:
         case VIR_STORAGE_NET_PROTOCOL_LAST:
+            virReportEnumRangeError(virStorageNetProtocol, src->protocol);
             return NULL;
         }
         break;
-- 
2.24.1





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux