提交 8bad8e7b 编写于 作者: P Peter Krempa

qemu: migration: Rename NBD migration functions

Drop the mention of 'drive mirror' from the function names and mention
NBD. This will help when adding the 'blockdev mirror' migration code
which will allow using TLS.

Additionally fix some of the function comments to make more sense
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
上级 99223c8c
......@@ -463,19 +463,18 @@ qemuMigrationDstStopNBDServer(virQEMUDriverPtr driver,
/**
* qemuMigrationSrcDriveMirrorReady:
* qemuMigrationSrcNBDStorageCopyReady:
* @vm: domain
*
* Check the status of all drive-mirrors started by
* qemuMigrationSrcDriveMirror. Any pending block job events
* for the mirrored disks will be processed.
* Check the status of all drives copied via qemuMigrationSrcNBDStorageCopy.
* Any pending block job events for the mirrored disks will be processed.
*
* Returns 1 if all mirrors are "ready",
* 0 if some mirrors are still performing initial sync,
* -1 on error.
*/
static int
qemuMigrationSrcDriveMirrorReady(virDomainObjPtr vm,
qemuMigrationSrcNBDStorageCopyReady(virDomainObjPtr vm,
qemuDomainAsyncJob asyncJob)
{
size_t i;
......@@ -530,7 +529,7 @@ qemuMigrationSrcDriveMirrorReady(virDomainObjPtr vm,
* -2 all mirrors are gone but some of them failed.
*/
static int
qemuMigrationDriveMirrorCancelled(virDomainObjPtr vm,
qemuMigrationSrcNBDCopyCancelled(virDomainObjPtr vm,
qemuDomainAsyncJob asyncJob,
bool check)
{
......@@ -617,7 +616,7 @@ qemuMigrationDriveMirrorCancelled(virDomainObjPtr vm,
* -1 on error or when job failed and failNoJob is true.
*/
static int
qemuMigrationSrcCancelOneDriveMirror(virQEMUDriverPtr driver,
qemuMigrationSrcNBDCopyCancelOne(virQEMUDriverPtr driver,
virDomainObjPtr vm,
virDomainDiskDefPtr disk,
bool failNoJob,
......@@ -672,19 +671,18 @@ qemuMigrationSrcCancelOneDriveMirror(virQEMUDriverPtr driver,
/**
* qemuMigrationSrcCancelDriveMirror:
* qemuMigrationSrcNBDCopyCancel:
* @driver: qemu driver
* @vm: domain
* @check: if true report an error when some of the mirrors fails
*
* Cancel all drive-mirrors started by qemuMigrationDriveMirror.
* Any pending block job events for the affected disks will be
* processed.
* Cancel all drive-mirrors started by qemuMigrationSrcNBDStorageCopy.
* Any pending block job events for the affected disks will be processed.
*
* Returns 0 on success, -1 otherwise.
*/
static int
qemuMigrationSrcCancelDriveMirror(virQEMUDriverPtr driver,
qemuMigrationSrcNBDCopyCancel(virQEMUDriverPtr driver,
virDomainObjPtr vm,
bool check,
qemuDomainAsyncJob asyncJob,
......@@ -705,7 +703,7 @@ qemuMigrationSrcCancelDriveMirror(virQEMUDriverPtr driver,
if (!diskPriv->migrating)
continue;
rv = qemuMigrationSrcCancelOneDriveMirror(driver, vm, disk,
rv = qemuMigrationSrcNBDCopyCancelOne(driver, vm, disk,
check, asyncJob);
if (rv != 0) {
if (rv < 0) {
......@@ -718,8 +716,7 @@ qemuMigrationSrcCancelDriveMirror(virQEMUDriverPtr driver,
}
}
while ((rv = qemuMigrationDriveMirrorCancelled(vm, asyncJob,
check)) != 1) {
while ((rv = qemuMigrationSrcNBDCopyCancelled(vm, asyncJob, check)) != 1) {
if (check && !failed &&
dconn && virConnectIsAlive(dconn) <= 0) {
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
......@@ -752,7 +749,7 @@ qemuMigrationSrcCancelDriveMirror(virQEMUDriverPtr driver,
/**
* qemuMigrationDriveMirror:
* qemuMigrationSrcNBDStorageCopy:
* @driver: qemu driver
* @vm: domain
* @mig: migration cookie
......@@ -760,19 +757,18 @@ qemuMigrationSrcCancelDriveMirror(virQEMUDriverPtr driver,
* @speed: bandwidth limit in MiB/s
* @migrate_flags: migrate monitor command flags
*
* Run drive-mirror to feed NBD server running on dst and wait
* till the process switches into another phase where writes go
* simultaneously to both source and destination. On success,
* update @migrate_flags so we don't tell 'migrate' command
* Migrate non-shared storage using the NBD protocol to the server running
* inside the qemu process on dst and wait until the copy converges.
* On success update @migrate_flags so we don't tell 'migrate' command
* to do the very same operation. On failure, the caller is
* expected to call qemuMigrationSrcCancelDriveMirror to stop all
* running mirrors.
* expected to call qemuMigrationSrcNBDCopyCancel to stop all
* running copy operations.
*
* Returns 0 on success (@migrate_flags updated),
* -1 otherwise.
*/
static int
qemuMigrationSrcDriveMirror(virQEMUDriverPtr driver,
qemuMigrationSrcNBDStorageCopy(virQEMUDriverPtr driver,
virDomainObjPtr vm,
qemuMigrationCookiePtr mig,
const char *host,
......@@ -857,8 +853,7 @@ qemuMigrationSrcDriveMirror(virQEMUDriverPtr driver,
}
}
while ((rv = qemuMigrationSrcDriveMirrorReady(vm,
QEMU_ASYNC_JOB_MIGRATION_OUT)) != 1) {
while ((rv = qemuMigrationSrcNBDStorageCopyReady(vm, QEMU_ASYNC_JOB_MIGRATION_OUT)) != 1) {
if (rv < 0)
goto cleanup;
......@@ -1364,7 +1359,7 @@ qemuMigrationAnyCompleted(virQEMUDriverPtr driver,
/* This flag should only be set when run on src host */
if (flags & QEMU_MIGRATION_COMPLETED_CHECK_STORAGE &&
qemuMigrationSrcDriveMirrorReady(vm, asyncJob) < 0)
qemuMigrationSrcNBDStorageCopyReady(vm, asyncJob) < 0)
goto error;
if (flags & QEMU_MIGRATION_COMPLETED_ABORT_ON_ERROR &&
......@@ -2852,7 +2847,7 @@ qemuMigrationSrcConfirmPhase(virQEMUDriverPtr driver,
int reason;
/* cancel any outstanding NBD jobs */
qemuMigrationSrcCancelDriveMirror(driver, vm, false,
qemuMigrationSrcNBDCopyCancel(driver, vm, false,
QEMU_ASYNC_JOB_MIGRATION_OUT, NULL);
virSetError(orig_err);
......@@ -3357,7 +3352,7 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver,
}
/* This will update migrate_flags on success */
if (qemuMigrationSrcDriveMirror(driver, vm, mig,
if (qemuMigrationSrcNBDStorageCopy(driver, vm, mig,
spec->dest.host.name,
migrate_speed,
&migrate_flags,
......@@ -3492,7 +3487,7 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver,
}
if (mig->nbd &&
qemuMigrationSrcCancelDriveMirror(driver, vm, true,
qemuMigrationSrcNBDCopyCancel(driver, vm, true,
QEMU_ASYNC_JOB_MIGRATION_OUT,
dconn) < 0)
goto error;
......@@ -3579,7 +3574,7 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver,
/* cancel any outstanding NBD jobs */
if (mig && mig->nbd)
qemuMigrationSrcCancelDriveMirror(driver, vm, false,
qemuMigrationSrcNBDCopyCancel(driver, vm, false,
QEMU_ASYNC_JOB_MIGRATION_OUT,
dconn);
......@@ -5270,7 +5265,7 @@ qemuMigrationSrcCancel(virQEMUDriverPtr driver,
}
}
if (qemuMigrationSrcCancelDriveMirror(driver, vm, false,
if (qemuMigrationSrcNBDCopyCancel(driver, vm, false,
QEMU_ASYNC_JOB_NONE, NULL) < 0)
goto endsyncjob;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册