Skip to content

Commit

Permalink
ch: Verify a disk's target bus type is supported
Browse files Browse the repository at this point in the history
Currently only virtio types of buses are supported so check if the
configuration we are given matches.
  • Loading branch information
bryteise committed Mar 19, 2021
1 parent 158fd61 commit de4cee1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ch/ch_monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,11 @@ virCHMonitorBuildDiskJson(virJSONValuePtr disks, virDomainDiskDefPtr diskdef)
diskdef->src->path != NULL &&
diskdef->src->type == VIR_STORAGE_TYPE_FILE) {
disk = virJSONValueNewObject();
if (diskdef->bus != VIR_DOMAIN_DISK_BUS_VIRTIO) {
virReportError(VIR_ERR_INVALID_ARG,
_("Only virtio bus types are supported for '%s'"), diskdef->src->path);
goto cleanup;
}
if (!virFileExists(diskdef->src->path)) {
virReportError(VIR_ERR_INVALID_ARG,
_("failed to find disk '%s'"), diskdef->src->path);
Expand Down

0 comments on commit de4cee1

Please sign in to comment.