Provide a proper user facing error when attempting to query block I/O throttling settings for an empty drive. Without this patch, a less meaningful internal error produced by qemuMonitorJSONBlockIoThrottleInfo would be propagated to the user. Signed-off-by: Fabian Leditzky <fabian@xxxxxxxxxx> --- src/qemu/qemu_driver.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d2eddbd9ae..1dd30ed444 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15368,6 +15368,14 @@ qemuDomainGetBlockIoTune(virDomainPtr dom, if (!qemuDomainDiskBlockIoTuneIsSupported(disk)) goto endjob; + /* qemu won't return block IO throttle settings for an empty cd-rom drive */ + if (virStorageSourceIsEmpty(disk->src)) { + virReportError(VIR_ERR_INVALID_ARG, + _("disk '%1$s' does not currently have a source assigned"), + path); + goto endjob; + } + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorGetBlockIoThrottle(priv->mon, QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName, &reply); qemuDomainObjExitMonitor(vm); -- 2.48.1