[libvirt] [PATCHv2 40/62] qemu: process: Add lookup via QOM id to qemuProcessFindDomainDiskByAlias

Ján Tomko jtomko at redhat.com
Thu Aug 16 13:09:39 UTC 2018


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 <pkrempa at 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 <jtomko at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180816/53e77293/attachment-0001.sig>


More information about the libvir-list mailing list