From: Peter Krempa Date: Fri, 6 Dec 2019 13:05:09 +0000 (+0100) Subject: qemu: driver: Use qemuDomainDiskByName instead of virDomainDiskByName X-Git-Tag: v6.0.0-rc1~478 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e3faa8481981cd17838926f156beef486b77580d;p=thirdparty%2Flibvirt.git qemu: driver: Use qemuDomainDiskByName instead of virDomainDiskByName Where appropriate replace the open coded call with the qemu wrapper which already reports the error. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index abd400cfee..572cea0d40 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -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;