qemu: report error for non-existing disk in blockjobinfo

Before:

 # virsh blockjob r7 vdc
 error: An error occurred, but the cause is unknown

After:

 # virsh blockjob r7 vdc
 error: Disk 'vdc' not found in the domain

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1241355

Signed-off-by: Luyao Huang <lhuang@redhat.com>
This commit is contained in:
Luyao Huang 2015-07-09 11:49:15 +08:00 committed by Martin Kletzander
parent 2e09729b1c
commit b5c2245b0c
1 changed files with 4 additions and 1 deletions

View File

@ -16414,8 +16414,11 @@ qemuDomainGetBlockJobInfo(virDomainPtr dom,
if (qemuDomainSupportsBlockJobs(vm, NULL) < 0)
goto endjob;
if (!(disk = virDomainDiskByName(vm->def, path, true)))
if (!(disk = virDomainDiskByName(vm->def, path, true))) {
virReportError(VIR_ERR_INVALID_ARG,
_("disk %s not found in the domain"), path);
goto endjob;
}
qemuDomainObjEnterMonitor(driver, vm);
ret = qemuMonitorGetBlockJobInfo(qemuDomainGetMonitor(vm),