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

Re: [libvirt] [PATCH RFC 24/51] qemu: blockjob: Track current state of blockjob



On Wed, Dec 12, 2018 at 06:08:40PM +0100, Peter Krempa wrote:
Add a field tracking the current state of job so that it can be queried
later. Until now the job state e.g. that the job is _READY for
finalizing was tracked only for mirror jobs. Add tracking of state for
all jobs.

Similarly to 'qemuBlockJobType' this maps the existing states of the
blockjob from virConnectDomainEventBlockJobStatus to
'qemuBlockJobState' so that we can track some internal states as well.

Signed-off-by: Peter Krempa <pkrempa redhat com>
---
src/qemu/qemu_blockjob.c  | 23 +++++++++++++++--------
src/qemu/qemu_blockjob.h  | 22 +++++++++++++++++++++-
src/qemu/qemu_domain.c    |  5 +++--
src/qemu/qemu_driver.c    |  3 +--
src/qemu/qemu_migration.c |  8 ++++++--
src/qemu/qemu_process.c   |  4 +++-
6 files changed, 49 insertions(+), 16 deletions(-)


diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index b9119c5b89..bde8697ede 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -702,8 +702,10 @@ qemuMigrationSrcNBDCopyCancel(virQEMUDriverPtr driver,
    for (i = 0; i < vm->def->ndisks; i++) {
        virDomainDiskDefPtr disk = vm->def->disks[i];
        qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
+        qemuBlockJobDataPtr job;

-        if (!diskPriv->blockjob->started)
+        if (!(job = qemuBlockJobDiskGetJob(disk)) ||
+            !qemuBlockJobIsRunning(job))
            diskPriv->migrating = false;

        if (!diskPriv->migrating)

There is 'continue;' right after, so we'll forget to unref job in the
case qemuBlockJobDiskGetJob returns non-NULL, but the job is not
running.

@@ -720,6 +722,8 @@ qemuMigrationSrcNBDCopyCancel(virQEMUDriverPtr driver,
            qemuBlockJobSyncEndDisk(vm, asyncJob, disk);
            diskPriv->migrating = false;
        }
+
+        virObjectUnref(job);
    }

    while ((rv = qemuMigrationSrcNBDCopyCancelled(vm, asyncJob, check)) != 1) {

Reviewed-by: Ján Tomko <jtomko redhat com>

Jano

Attachment: signature.asc
Description: PGP signature


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