Now we basically ignore qemu block job event if there is no correspondent block
job object in libvirt. So we need to precreate block job objects before we call
qemu's query-block-job because we can receive events right after receiving
query-block-job result but before we create block job object in libvirt and
miss this event.
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy(a)virtuozzo.com>
---
src/qemu/qemu_process.c | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index a810f38..549c17a 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -8153,8 +8153,8 @@ qemuProcessRefreshLegacyBlockjob(void *payload,
disk->mirrorJob == VIR_DOMAIN_BLOCK_JOB_TYPE_ACTIVE_COMMIT)
jobtype = disk->mirrorJob;
- if (!(job = qemuBlockJobDiskNew(vm, disk, jobtype, jobname)))
- return -1;
+ job = qemuBlockJobDiskGetJob(disk);
+ job->type = jobtype;
if (disk->mirror) {
if (info->ready == 1 ||
@@ -8199,6 +8199,16 @@ qemuProcessRefreshLegacyBlockjobs(virQEMUDriverPtr driver,
{
GHashTable *blockJobs = NULL;
int ret = -1;
+ size_t i;
+
+ for (i = 0; i < vm->def->ndisks; i++) {
+ virDomainDiskDefPtr disk = vm->def->disks[i];
+ g_autoptr(qemuBlockJobData) job = NULL;
+ g_autofree char *jobname = NULL;
+
+ jobname = qemuAliasDiskDriveFromDisk(disk);
+ job = qemuBlockJobDiskNew(vm, disk, QEMU_BLOCKJOB_TYPE_NONE, jobname);
+ }
qemuDomainObjEnterMonitor(driver, vm);
blockJobs = qemuMonitorGetAllBlockJobInfo(qemuDomainGetMonitor(vm), true);
@@ -8208,6 +8218,13 @@ qemuProcessRefreshLegacyBlockjobs(virQEMUDriverPtr driver,
if (virHashForEach(blockJobs, qemuProcessRefreshLegacyBlockjob, vm) < 0)
goto cleanup;
+ for (i = 0; i < vm->def->ndisks; i++) {
+ virDomainDiskDefPtr disk = vm->def->disks[i];
+ qemuBlockJobDataPtr job = qemuBlockJobDiskGetJob(disk);
+
+ qemuBlockJobStartupFinalize(vm, job);
+ }
+
ret = 0;
cleanup:
--
1.8.3.1