/**
- * 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,
- qemuDomainAsyncJob asyncJob)
+qemuMigrationSrcNBDStorageCopyReady(virDomainObjPtr vm,
+ qemuDomainAsyncJob asyncJob)
{
size_t i;
size_t notReady = 0;
* -2 all mirrors are gone but some of them failed.
*/
static int
-qemuMigrationDriveMirrorCancelled(virDomainObjPtr vm,
- qemuDomainAsyncJob asyncJob,
- bool check)
+qemuMigrationSrcNBDCopyCancelled(virDomainObjPtr vm,
+ qemuDomainAsyncJob asyncJob,
+ bool check)
{
size_t i;
size_t active = 0;
* -1 on error or when job failed and failNoJob is true.
*/
static int
-qemuMigrationSrcCancelOneDriveMirror(virQEMUDriverPtr driver,
- virDomainObjPtr vm,
- virDomainDiskDefPtr disk,
- bool failNoJob,
- qemuDomainAsyncJob asyncJob)
+qemuMigrationSrcNBDCopyCancelOne(virQEMUDriverPtr driver,
+ virDomainObjPtr vm,
+ virDomainDiskDefPtr disk,
+ bool failNoJob,
+ qemuDomainAsyncJob asyncJob)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
char *diskAlias = NULL;
/**
- * 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,
- virDomainObjPtr vm,
- bool check,
- qemuDomainAsyncJob asyncJob,
- virConnectPtr dconn)
+qemuMigrationSrcNBDCopyCancel(virQEMUDriverPtr driver,
+ virDomainObjPtr vm,
+ bool check,
+ qemuDomainAsyncJob asyncJob,
+ virConnectPtr dconn)
{
virErrorPtr err = NULL;
int ret = -1;
if (!diskPriv->migrating)
continue;
- rv = qemuMigrationSrcCancelOneDriveMirror(driver, vm, disk,
- check, asyncJob);
+ rv = qemuMigrationSrcNBDCopyCancelOne(driver, vm, disk,
+ check, asyncJob);
if (rv != 0) {
if (rv < 0) {
if (!err)
}
}
- 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",
/**
- * qemuMigrationDriveMirror:
+ * qemuMigrationSrcNBDStorageCopy:
* @driver: qemu driver
* @vm: domain
* @mig: migration cookie
* @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,
- virDomainObjPtr vm,
- qemuMigrationCookiePtr mig,
- const char *host,
- unsigned long speed,
- unsigned int *migrate_flags,
- size_t nmigrate_disks,
- const char **migrate_disks,
- virConnectPtr dconn)
+qemuMigrationSrcNBDStorageCopy(virQEMUDriverPtr driver,
+ virDomainObjPtr vm,
+ qemuMigrationCookiePtr mig,
+ const char *host,
+ unsigned long speed,
+ unsigned int *migrate_flags,
+ size_t nmigrate_disks,
+ const char **migrate_disks,
+ virConnectPtr dconn)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
int ret = -1;
}
}
- 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;
/* 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 &&
int reason;
/* cancel any outstanding NBD jobs */
- qemuMigrationSrcCancelDriveMirror(driver, vm, false,
- QEMU_ASYNC_JOB_MIGRATION_OUT, NULL);
+ qemuMigrationSrcNBDCopyCancel(driver, vm, false,
+ QEMU_ASYNC_JOB_MIGRATION_OUT, NULL);
virSetError(orig_err);
virFreeError(orig_err);
}
/* This will update migrate_flags on success */
- if (qemuMigrationSrcDriveMirror(driver, vm, mig,
- spec->dest.host.name,
- migrate_speed,
- &migrate_flags,
- nmigrate_disks,
- migrate_disks,
- dconn) < 0) {
+ if (qemuMigrationSrcNBDStorageCopy(driver, vm, mig,
+ spec->dest.host.name,
+ migrate_speed,
+ &migrate_flags,
+ nmigrate_disks,
+ migrate_disks,
+ dconn) < 0) {
goto error;
}
} else {
}
if (mig->nbd &&
- qemuMigrationSrcCancelDriveMirror(driver, vm, true,
- QEMU_ASYNC_JOB_MIGRATION_OUT,
- dconn) < 0)
+ qemuMigrationSrcNBDCopyCancel(driver, vm, true,
+ QEMU_ASYNC_JOB_MIGRATION_OUT,
+ dconn) < 0)
goto error;
/* When migration was paused before serializing device state we need to
/* cancel any outstanding NBD jobs */
if (mig && mig->nbd)
- qemuMigrationSrcCancelDriveMirror(driver, vm, false,
- QEMU_ASYNC_JOB_MIGRATION_OUT,
- dconn);
+ qemuMigrationSrcNBDCopyCancel(driver, vm, false,
+ QEMU_ASYNC_JOB_MIGRATION_OUT,
+ dconn);
if (priv->job.current->status != QEMU_DOMAIN_JOB_STATUS_CANCELED)
priv->job.current->status = QEMU_DOMAIN_JOB_STATUS_FAILED;
}
}
- if (qemuMigrationSrcCancelDriveMirror(driver, vm, false,
- QEMU_ASYNC_JOB_NONE, NULL) < 0)
+ if (qemuMigrationSrcNBDCopyCancel(driver, vm, false,
+ QEMU_ASYNC_JOB_NONE, NULL) < 0)
goto endsyncjob;
ret = 0;