]> xenbits.xensource.com Git - libvirt.git/commitdiff
Explicitly reject unsupported storage types for legacy config generators
authorPeter Krempa <pkrempa@redhat.com>
Fri, 9 Jun 2023 14:27:57 +0000 (16:27 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 26 Jun 2023 12:53:36 +0000 (14:53 +0200)
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 <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/libxl/xen_xl.c
src/qemu/qemu_command.c

index 77f9f112f0f88d11dadc67a60b17f4708947fc82..1cc42fa59f3ec3c25edd30084605699a5868e3b9 100644 (file)
@@ -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;
index 85c5973339d3668212ce93bf6bfc950caaad2c0d..cde6ab4dde65a33948fff110cb91825b7457175a 100644 (file)
@@ -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) {