New storage types are not implemented in generators for -drive and the
xen config. Explicitly reject them in case of a programming error.

Signed-off-by: Peter Krempa <pkre...@redhat.com>
---
 src/libxl/xen_xl.c      | 4 +++-
 src/qemu/qemu_command.c | 5 +++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c
index 77f9f112f0..1cc42fa59f 100644
--- a/src/libxl/xen_xl.c
+++ b/src/libxl/xen_xl.c
@@ -1525,7 +1525,9 @@ xenFormatXLDiskSrc(virStorageSource *src, char **srcstr)
     case VIR_STORAGE_TYPE_VHOST_USER:
     case VIR_STORAGE_TYPE_NONE:
     case VIR_STORAGE_TYPE_LAST:
-        break;
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("unsupported storage type for this code path"));
+        return -1;
     }

     return 0;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index a19902988c..8f5bc02459 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1638,10 +1638,11 @@ qemuBuildDriveSourceStr(virDomainDiskDef *disk,
     case VIR_STORAGE_TYPE_VHOST_USER:
     case VIR_STORAGE_TYPE_NONE:
     case VIR_STORAGE_TYPE_LAST:
-        break;
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("unsupported storage type for this code path"));
+        return -1;
     }

-
     virBufferAddLit(buf, ",");

     if (encinfo) {
-- 
2.40.1

Reply via email to