qemu: blockjob: Drop unnecessary calls to qemuBlockJobSyncEndDisk

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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2018-11-22 18:34:42 +01:00
parent e0c4d4fcf0
commit addb82bc5f
2 changed files with 5 additions and 7 deletions

View File

@ -392,7 +392,9 @@ qemuBlockJobSyncBeginDisk(virDomainDiskDefPtr disk)
* @disk: domain disk * @disk: domain disk
* *
* End a synchronous block job for @disk. Any pending block job event * 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 void
qemuBlockJobSyncEndDisk(virDomainObjPtr vm, qemuBlockJobSyncEndDisk(virDomainObjPtr vm,

View File

@ -703,10 +703,8 @@ qemuMigrationSrcNBDCopyCancel(virQEMUDriverPtr driver,
virDomainDiskDefPtr disk = vm->def->disks[i]; virDomainDiskDefPtr disk = vm->def->disks[i];
qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk); qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
if (!diskPriv->blockjob->started) { if (!diskPriv->blockjob->started)
qemuBlockJobSyncEndDisk(vm, asyncJob, disk);
diskPriv->migrating = false; diskPriv->migrating = false;
}
if (!diskPriv->migrating) if (!diskPriv->migrating)
continue; continue;
@ -929,10 +927,8 @@ qemuMigrationSrcNBDStorageCopyOne(virQEMUDriverPtr driver,
mirror_flags); mirror_flags);
} }
if (rc < 0) { if (rc < 0)
qemuBlockJobSyncEndDisk(vm, QEMU_ASYNC_JOB_MIGRATION_OUT, disk);
goto cleanup; goto cleanup;
}
diskPriv->migrating = true; diskPriv->migrating = true;
qemuBlockJobStarted(job); qemuBlockJobStarted(job);