[libvirt] [PATCH RFC 19/51] qemu: blockjob: Drop unnecessary calls to qemuBlockJobSyncEndDisk

Peter Krempa pkrempa at redhat.com
Wed Dec 12 17:08:35 UTC 2018


If the job wasn't started, we don't need to end the synchronous job. Add
a note and drop the unnecessary calls.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_blockjob.c  | 4 +++-
 src/qemu/qemu_migration.c | 8 ++------
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index a3dc231b32..17657a9d9b 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -391,7 +391,9 @@ qemuBlockJobSyncBeginDisk(virDomainDiskDefPtr disk)
  * @disk: domain disk
  *
  * End a synchronous block job for @disk. Any pending block job event
- * for the disk is processed.
+ * for the disk is processed. Note that it's not necessary to call this function
+ * in case the block job was not started successfully if
+ * qemuBlockJobStartupFinalize will be called.
  */
 void
 qemuBlockJobSyncEndDisk(virDomainObjPtr vm,
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 79ad2efe75..dbf35b0829 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -703,10 +703,8 @@ qemuMigrationSrcNBDCopyCancel(virQEMUDriverPtr driver,
         virDomainDiskDefPtr disk = vm->def->disks[i];
         qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);

-        if (!diskPriv->blockjob->started) {
-            qemuBlockJobSyncEndDisk(vm, asyncJob, disk);
+        if (!diskPriv->blockjob->started)
             diskPriv->migrating = false;
-        }

         if (!diskPriv->migrating)
             continue;
@@ -929,10 +927,8 @@ qemuMigrationSrcNBDStorageCopyOne(virQEMUDriverPtr driver,
                                                        mirror_flags);
     }

-    if (rc < 0) {
-        qemuBlockJobSyncEndDisk(vm, QEMU_ASYNC_JOB_MIGRATION_OUT, disk);
+    if (rc < 0)
         goto cleanup;
-    }

     VIR_FREE(diskAlias);
     diskPriv->migrating = true;
-- 
2.19.2




More information about the libvir-list mailing list