From f4fea84f59b5e6b103cf9b8918a003e5081c1af8 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Fri, 9 Jun 2023 16:27:57 +0200 Subject: [PATCH] Explicitly reject unsupported storage types for legacy config generators 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 Reviewed-by: Michal Privoznik --- 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 85c5973339..cde6ab4dde 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) {