]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: driver: Use qemuDomainDiskByName instead of virDomainDiskByName
authorPeter Krempa <pkrempa@redhat.com>
Fri, 6 Dec 2019 13:05:09 +0000 (14:05 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 9 Dec 2019 06:11:23 +0000 (07:11 +0100)
Where appropriate replace the open coded call with the qemu wrapper
which already reports the error.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
src/qemu/qemu_driver.c

index abd400cfee561340799591a693943398b6225e47..572cea0d40bb6f22a1fcfc9130d523321db8431f 100644 (file)
@@ -11890,12 +11890,8 @@ qemuDomainBlockPeek(virDomainPtr dom,
     if (virDomainBlockPeekEnsureACL(dom->conn, vm->def) < 0)
         goto cleanup;
 
-    /* Check the path belongs to this domain.  */
-    if (!(disk = virDomainDiskByName(vm->def, path, true))) {
-        virReportError(VIR_ERR_INVALID_ARG,
-                       _("invalid disk or path '%s'"), path);
+    if (!(disk = qemuDomainDiskByName(vm->def, path)))
         goto cleanup;
-    }
 
     if (disk->src->format != VIR_STORAGE_FILE_RAW) {
         virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
@@ -17828,11 +17824,8 @@ qemuDomainGetBlockJobInfo(virDomainPtr dom,
     if (virDomainObjCheckActive(vm) < 0)
         goto endjob;
 
-    if (!(disk = virDomainDiskByName(vm->def, path, true))) {
-        virReportError(VIR_ERR_INVALID_ARG,
-                       _("disk %s not found in the domain"), path);
+    if (!(disk = qemuDomainDiskByName(vm->def, path)))
         goto endjob;
-    }
 
     if (!(job = qemuBlockJobDiskGetJob(disk))) {
         ret = 0;