On Mon, Aug 13, 2018 at 06:00:14PM +0200, Peter Krempa wrote:
Allow looking up also via QOM id and rename the function accordingly.
Also add documentation of the specifics.

Signed-off-by: Peter Krempa <pkre...@redhat.com>
---
src/qemu/qemu_driver.c  |  2 +-
src/qemu/qemu_process.c | 42 +++++++++++++++++++++++++++++++-----------
src/qemu/qemu_process.h |  5 +++--
3 files changed, 35 insertions(+), 14 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index f745a0392a..5dee701dc4 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4727,7 +4727,7 @@ processBlockJobEvent(virQEMUDriverPtr driver,
        goto endjob;
    }

-    if ((disk = qemuProcessFindDomainDiskByAlias(vm, diskAlias)))
+    if ((disk = qemuProcessFindDomainDiskByAliasOrQOM(vm, diskAlias, NULL)))
        qemuBlockJobEventProcess(driver, vm, disk, QEMU_ASYNC_JOB_NONE, type, 
status);

 endjob:
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 3495733041..b713afa3a2 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -350,28 +350,48 @@ qemuProcessHandleMonitorError(qemuMonitorPtr mon 
ATTRIBUTE_UNUSED,
}


+/**
+ * qemuProcessFindDomainDiskByAliasOrQOM:
+ * @vm: domain object to search for the disk
+ * @alias: -drive or -device alias of the disk
+ * @qomid: QOM tree device name
+ *
+ * Looks up a disk in the domain definition of @vm which either matches the
+ * -drive or -device alias used for the backend and frontend respectively or 
the
+ *  QOM name. If @alias is empty it's treated as NULL as it's a mandatory field
+ *  in some cases.
+ *
+ *  Returns a disk from @vm or NULL if it could not be found.

Three out of the last four lines are misaligned.

With the crasher fixup applied:

Reviewed-by: Ján Tomko <jto...@redhat.com>

Jano

Attachment: signature.asc
Description: Digital signature

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

Reply via email to