qemu: blockjob: Rename public APIs

All the public APIs of the qemu_blockjob module operate on a 'disk'.
Since I'll be adding APIs which operate on a job later let's rename the
existing ones.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2018-10-16 16:36:18 +02:00
parent 359dc694f7
commit f2bc59e48e
4 changed files with 37 additions and 37 deletions

View File

@ -198,7 +198,7 @@ qemuBlockJobEventProcess(virQEMUDriverPtr driver,
/** /**
* qemuBlockJobUpdate: * qemuBlockJobUpdateDisk:
* @vm: domain * @vm: domain
* @disk: domain disk * @disk: domain disk
* @error: error (output parameter) * @error: error (output parameter)
@ -209,10 +209,10 @@ qemuBlockJobEventProcess(virQEMUDriverPtr driver,
* Returns the block job event processed or -1 if there was no pending event. * Returns the block job event processed or -1 if there was no pending event.
*/ */
int int
qemuBlockJobUpdate(virDomainObjPtr vm, qemuBlockJobUpdateDisk(virDomainObjPtr vm,
qemuDomainAsyncJob asyncJob, qemuDomainAsyncJob asyncJob,
virDomainDiskDefPtr disk, virDomainDiskDefPtr disk,
char **error) char **error)
{ {
qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk); qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
qemuDomainObjPrivatePtr priv = vm->privateData; qemuDomainObjPrivatePtr priv = vm->privateData;
@ -237,20 +237,20 @@ qemuBlockJobUpdate(virDomainObjPtr vm,
/** /**
* qemuBlockJobSyncBegin: * qemuBlockJobSyncBeginDisk:
* @disk: domain disk * @disk: domain disk
* *
* Begin a new synchronous block job for @disk. The synchronous * Begin a new synchronous block job for @disk. The synchronous
* block job is ended by a call to qemuBlockJobSyncEnd, or by * block job is ended by a call to qemuBlockJobSyncEndDisk, or by
* the guest quitting. * the guest quitting.
* *
* During a synchronous block job, a block job event for @disk * During a synchronous block job, a block job event for @disk
* will not be processed asynchronously. Instead, it will be * will not be processed asynchronously. Instead, it will be
* processed only when qemuBlockJobUpdate or qemuBlockJobSyncEnd * processed only when qemuBlockJobUpdateDisk or qemuBlockJobSyncEndDisk
* is called. * is called.
*/ */
void void
qemuBlockJobSyncBegin(virDomainDiskDefPtr disk) qemuBlockJobSyncBeginDisk(virDomainDiskDefPtr disk)
{ {
qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk); qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
@ -261,7 +261,7 @@ qemuBlockJobSyncBegin(virDomainDiskDefPtr disk)
/** /**
* qemuBlockJobSyncEnd: * qemuBlockJobSyncEndDisk:
* @vm: domain * @vm: domain
* @disk: domain disk * @disk: domain disk
* *
@ -269,11 +269,11 @@ qemuBlockJobSyncBegin(virDomainDiskDefPtr disk)
* for the disk is processed. * for the disk is processed.
*/ */
void void
qemuBlockJobSyncEnd(virDomainObjPtr vm, qemuBlockJobSyncEndDisk(virDomainObjPtr vm,
qemuDomainAsyncJob asyncJob, qemuDomainAsyncJob asyncJob,
virDomainDiskDefPtr disk) virDomainDiskDefPtr disk)
{ {
VIR_DEBUG("disk=%s", disk->dst); VIR_DEBUG("disk=%s", disk->dst);
qemuBlockJobUpdate(vm, asyncJob, disk, NULL); qemuBlockJobUpdateDisk(vm, asyncJob, disk, NULL);
QEMU_DOMAIN_DISK_PRIVATE(disk)->blockJobSync = false; QEMU_DOMAIN_DISK_PRIVATE(disk)->blockJobSync = false;
} }

View File

@ -26,14 +26,14 @@
# include "qemu_conf.h" # include "qemu_conf.h"
# include "qemu_domain.h" # include "qemu_domain.h"
int qemuBlockJobUpdate(virDomainObjPtr vm, int qemuBlockJobUpdateDisk(virDomainObjPtr vm,
qemuDomainAsyncJob asyncJob, qemuDomainAsyncJob asyncJob,
virDomainDiskDefPtr disk, virDomainDiskDefPtr disk,
char **error); char **error);
void qemuBlockJobSyncBegin(virDomainDiskDefPtr disk); void qemuBlockJobSyncBeginDisk(virDomainDiskDefPtr disk);
void qemuBlockJobSyncEnd(virDomainObjPtr vm, void qemuBlockJobSyncEndDisk(virDomainObjPtr vm,
qemuDomainAsyncJob asyncJob, qemuDomainAsyncJob asyncJob,
virDomainDiskDefPtr disk); virDomainDiskDefPtr disk);
#endif /* LIBVIRT_QEMU_BLOCKJOB_H */ #endif /* LIBVIRT_QEMU_BLOCKJOB_H */

View File

@ -4737,7 +4737,7 @@ processBlockJobEvent(virQEMUDriverPtr driver,
diskPriv->blockJobType = type; diskPriv->blockJobType = type;
diskPriv->blockJobStatus = status; diskPriv->blockJobStatus = status;
qemuBlockJobUpdate(vm, QEMU_ASYNC_JOB_NONE, disk, NULL); qemuBlockJobUpdateDisk(vm, QEMU_ASYNC_JOB_NONE, disk, NULL);
endjob: endjob:
qemuDomainObjEndJob(driver, vm); qemuDomainObjEndJob(driver, vm);
@ -17409,7 +17409,7 @@ qemuDomainBlockJobAbort(virDomainPtr dom,
} }
if (!async) if (!async)
qemuBlockJobSyncBegin(disk); qemuBlockJobSyncBeginDisk(disk);
if (pivot) { if (pivot) {
if ((ret = qemuDomainBlockPivot(driver, vm, device, disk)) < 0) if ((ret = qemuDomainBlockPivot(driver, vm, device, disk)) < 0)
@ -17448,19 +17448,19 @@ qemuDomainBlockJobAbort(virDomainPtr dom,
* scheduled block jobs from confusing us. */ * scheduled block jobs from confusing us. */
if (!async) { if (!async) {
qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk); qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
qemuBlockJobUpdate(vm, QEMU_ASYNC_JOB_NONE, disk, NULL); qemuBlockJobUpdateDisk(vm, QEMU_ASYNC_JOB_NONE, disk, NULL);
while (diskPriv->blockjob) { while (diskPriv->blockjob) {
if (virDomainObjWait(vm) < 0) { if (virDomainObjWait(vm) < 0) {
ret = -1; ret = -1;
goto endjob; goto endjob;
} }
qemuBlockJobUpdate(vm, QEMU_ASYNC_JOB_NONE, disk, NULL); qemuBlockJobUpdateDisk(vm, QEMU_ASYNC_JOB_NONE, disk, NULL);
} }
} }
endjob: endjob:
if (disk) if (disk)
qemuBlockJobSyncEnd(vm, QEMU_ASYNC_JOB_NONE, disk); qemuBlockJobSyncEndDisk(vm, QEMU_ASYNC_JOB_NONE, disk);
qemuDomainObjEndJob(driver, vm); qemuDomainObjEndJob(driver, vm);
cleanup: cleanup:

View File

@ -490,7 +490,7 @@ qemuMigrationSrcNBDStorageCopyReady(virDomainObjPtr vm,
if (!diskPriv->migrating) if (!diskPriv->migrating)
continue; continue;
status = qemuBlockJobUpdate(vm, asyncJob, disk, &error); status = qemuBlockJobUpdateDisk(vm, asyncJob, disk, &error);
if (status == VIR_DOMAIN_BLOCK_JOB_FAILED) { if (status == VIR_DOMAIN_BLOCK_JOB_FAILED) {
if (error) { if (error) {
virReportError(VIR_ERR_OPERATION_FAILED, virReportError(VIR_ERR_OPERATION_FAILED,
@ -549,7 +549,7 @@ qemuMigrationSrcNBDCopyCancelled(virDomainObjPtr vm,
if (!diskPriv->migrating) if (!diskPriv->migrating)
continue; continue;
status = qemuBlockJobUpdate(vm, asyncJob, disk, &error); status = qemuBlockJobUpdateDisk(vm, asyncJob, disk, &error);
switch (status) { switch (status) {
case VIR_DOMAIN_BLOCK_JOB_FAILED: case VIR_DOMAIN_BLOCK_JOB_FAILED:
if (check) { if (check) {
@ -566,7 +566,7 @@ qemuMigrationSrcNBDCopyCancelled(virDomainObjPtr vm,
ATTRIBUTE_FALLTHROUGH; ATTRIBUTE_FALLTHROUGH;
case VIR_DOMAIN_BLOCK_JOB_CANCELED: case VIR_DOMAIN_BLOCK_JOB_CANCELED:
case VIR_DOMAIN_BLOCK_JOB_COMPLETED: case VIR_DOMAIN_BLOCK_JOB_COMPLETED:
qemuBlockJobSyncEnd(vm, asyncJob, disk); qemuBlockJobSyncEndDisk(vm, asyncJob, disk);
diskPriv->migrating = false; diskPriv->migrating = false;
break; break;
@ -630,7 +630,7 @@ qemuMigrationSrcNBDCopyCancelOne(virQEMUDriverPtr driver,
int status; int status;
int rv; int rv;
status = qemuBlockJobUpdate(vm, asyncJob, disk, &error); status = qemuBlockJobUpdateDisk(vm, asyncJob, disk, &error);
switch (status) { switch (status) {
case VIR_DOMAIN_BLOCK_JOB_FAILED: case VIR_DOMAIN_BLOCK_JOB_FAILED:
case VIR_DOMAIN_BLOCK_JOB_CANCELED: case VIR_DOMAIN_BLOCK_JOB_CANCELED:
@ -712,7 +712,7 @@ qemuMigrationSrcNBDCopyCancel(virQEMUDriverPtr driver,
err = virSaveLastError(); err = virSaveLastError();
failed = true; failed = true;
} }
qemuBlockJobSyncEnd(vm, asyncJob, disk); qemuBlockJobSyncEndDisk(vm, asyncJob, disk);
diskPriv->migrating = false; diskPriv->migrating = false;
} }
} }
@ -954,7 +954,7 @@ qemuMigrationSrcNBDStorageCopy(virQEMUDriverPtr driver,
if (!(diskAlias = qemuAliasDiskDriveFromDisk(disk))) if (!(diskAlias = qemuAliasDiskDriveFromDisk(disk)))
goto cleanup; goto cleanup;
qemuBlockJobSyncBegin(disk); qemuBlockJobSyncBeginDisk(disk);
if (flags & VIR_MIGRATE_TLS) { if (flags & VIR_MIGRATE_TLS) {
rc = qemuMigrationSrcNBDStorageCopyBlockdev(driver, vm, rc = qemuMigrationSrcNBDStorageCopyBlockdev(driver, vm,
@ -971,7 +971,7 @@ qemuMigrationSrcNBDStorageCopy(virQEMUDriverPtr driver,
} }
if (rc < 0) { if (rc < 0) {
qemuBlockJobSyncEnd(vm, QEMU_ASYNC_JOB_MIGRATION_OUT, disk); qemuBlockJobSyncEndDisk(vm, QEMU_ASYNC_JOB_MIGRATION_OUT, disk);
goto cleanup; goto cleanup;
} }
@ -5355,7 +5355,7 @@ qemuMigrationSrcCancel(virQEMUDriverPtr driver,
for (i = 0; i < vm->def->ndisks; i++) { for (i = 0; i < vm->def->ndisks; i++) {
virDomainDiskDefPtr disk = vm->def->disks[i]; virDomainDiskDefPtr disk = vm->def->disks[i];
if (QEMU_DOMAIN_DISK_PRIVATE(disk)->migrating) { if (QEMU_DOMAIN_DISK_PRIVATE(disk)->migrating) {
qemuBlockJobSyncBegin(disk); qemuBlockJobSyncBeginDisk(disk);
storage = true; storage = true;
} }
} }
@ -5385,7 +5385,7 @@ qemuMigrationSrcCancel(virQEMUDriverPtr driver,
VIR_DEBUG("Drive mirror on disk %s is still running", disk->dst); VIR_DEBUG("Drive mirror on disk %s is still running", disk->dst);
} else { } else {
VIR_DEBUG("Drive mirror on disk %s is gone", disk->dst); VIR_DEBUG("Drive mirror on disk %s is gone", disk->dst);
qemuBlockJobSyncEnd(vm, QEMU_ASYNC_JOB_NONE, disk); qemuBlockJobSyncEndDisk(vm, QEMU_ASYNC_JOB_NONE, disk);
diskPriv->migrating = false; diskPriv->migrating = false;
} }
} }
@ -5407,7 +5407,7 @@ qemuMigrationSrcCancel(virQEMUDriverPtr driver,
qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk); qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
if (diskPriv->migrating) { if (diskPriv->migrating) {
qemuBlockJobSyncEnd(vm, QEMU_ASYNC_JOB_NONE, disk); qemuBlockJobSyncEndDisk(vm, QEMU_ASYNC_JOB_NONE, disk);
diskPriv->migrating = false; diskPriv->migrating = false;
} }
} }