Skip to content

Commit de4cee1

Browse files
committed
ch: Verify a disk's target bus type is supported
Currently only virtio types of buses are supported so check if the configuration we are given matches.
1 parent 158fd61 commit de4cee1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/ch/ch_monitor.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,11 @@ virCHMonitorBuildDiskJson(virJSONValuePtr disks, virDomainDiskDefPtr diskdef)
256256
diskdef->src->path != NULL &&
257257
diskdef->src->type == VIR_STORAGE_TYPE_FILE) {
258258
disk = virJSONValueNewObject();
259+
if (diskdef->bus != VIR_DOMAIN_DISK_BUS_VIRTIO) {
260+
virReportError(VIR_ERR_INVALID_ARG,
261+
_("Only virtio bus types are supported for '%s'"), diskdef->src->path);
262+
goto cleanup;
263+
}
259264
if (!virFileExists(diskdef->src->path)) {
260265
virReportError(VIR_ERR_INVALID_ARG,
261266
_("failed to find disk '%s'"), diskdef->src->path);

0 commit comments

Comments
 (0)