]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
qemu: report error for non-existing disk in blockjobinfo
authorLuyao Huang <lhuang@redhat.com>
Thu, 9 Jul 2015 03:49:15 +0000 (11:49 +0800)
committerMartin Kletzander <mkletzan@redhat.com>
Thu, 9 Jul 2015 14:10:05 +0000 (16:10 +0200)
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>
src/qemu/qemu_driver.c

index 900740eb5b26228bbee36293123a46cfa7e8b9d9..ba804429a28acd458067039d8c901f05f18c73f5 100644 (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),