Re: [PATCH RFC 01/51] qemu: blockjob: Extract emitting of libvirt events

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

 



On Wed, Dec 12, 2018 at 06:08:17PM +0100, Peter Krempa wrote:
Put the emitting of VIR_DOMAIN_EVENT_ID_BLOCK_JOB and
VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2 into a separate function.

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

diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index 0f52996ade..ea327b83fe 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -42,6 +42,30 @@
VIR_LOG_INIT("qemu.qemu_blockjob");


+/**
+ * qemuBlockJobEmitEvents:
+ *
+ * Emits the VIR_DOMAIN_EVENT_ID_BLOCK_JOB and VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2
+ * for a block job.
+ */
+static void
+qemuBlockJobEmitEvents(virQEMUDriverPtr driver,
+                       virDomainObjPtr vm,
+                       virDomainDiskDefPtr disk,
+                       virDomainBlockJobType type,
+                       virConnectDomainEventBlockJobStatus status)
+{
+    virObjectEventPtr event = NULL;
+    virObjectEventPtr event2 = NULL;
+
+    event = virDomainEventBlockJobNewFromObj(vm, disk->src->path, type, status);

The original function uses the virDomainDiskGetSource wrapper,
but here you access disk->src->path directly.

+    virObjectEventStateQueue(driver->domainEventState, event);
+
+    event2 = virDomainEventBlockJob2NewFromObj(vm, disk->dst, type, status);
+    virObjectEventStateQueue(driver->domainEventState, event2);
+}
+
+
/**
 * qemuBlockJobUpdate:
 * @vm: domain

With that addressed:
Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx>

Jano

Attachment: signature.asc
Description: PGP signature

--
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