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(a)redhat.com>
---
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(a)redhat.com>
Jano