[PATCH 2/3] qemu: driver: Use qemuDomainDiskByName instead of virDomainDiskByName

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Where appropriate replace the open coded call with the qemu wrapper
which already reports the error.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_driver.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index bad2fb52f3..82f70465bc 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -11880,12 +11880,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,
@@ -17818,11 +17814,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;
-- 
2.23.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux