/*
- * If @check is true, the function will report an error and return a different
- * code in case a block job fails. This way we can properly abort migration in
- * case some block jobs failed once all memory has already been transferred.
+ * If @abortMigration is false, the function will report an error and return a
+ * different code in case a block job fails. This way we can properly abort
+ * migration in case some block jobs failed once all memory has already been
+ * transferred.
*
* Returns 1 if all mirrors are gone,
* 0 if some mirrors are still active,
static int
qemuMigrationSrcNBDCopyCancelled(virDomainObj *vm,
qemuDomainAsyncJob asyncJob,
- bool check)
+ bool abortMigration)
{
size_t i;
size_t active = 0;
qemuBlockJobUpdate(vm, job, asyncJob);
switch (job->state) {
case VIR_DOMAIN_BLOCK_JOB_FAILED:
- if (check) {
+ if (!abortMigration) {
qemuMigrationNBDReportMirrorError(job, disk->dst);
failed = true;
}
virDomainObj *vm,
virDomainDiskDef *disk,
qemuBlockJobData *job,
- bool failNoJob,
+ bool abortMigration,
qemuDomainAsyncJob asyncJob)
{
qemuDomainObjPrivate *priv = vm->privateData;
switch (job->state) {
case VIR_DOMAIN_BLOCK_JOB_FAILED:
case VIR_DOMAIN_BLOCK_JOB_CANCELED:
- if (failNoJob) {
+ if (!abortMigration) {
qemuMigrationNBDReportMirrorError(job, disk->dst);
return -1;
}
* qemuMigrationSrcNBDCopyCancel:
* @driver: qemu driver
* @vm: domain
- * @check: if true report an error when some of the mirrors fails
+ * @abortMigration: The migration is being cancelled.
*
* Cancel all drive-mirrors started by qemuMigrationSrcNBDStorageCopy.
* Any pending block job events for the affected disks will be processed and
static int
qemuMigrationSrcNBDCopyCancel(virQEMUDriver *driver,
virDomainObj *vm,
- bool check,
+ bool abortMigration,
qemuDomainAsyncJob asyncJob,
virConnectPtr dconn)
{
}
rv = qemuMigrationSrcNBDCopyCancelOne(driver, vm, disk, job,
- check, asyncJob);
+ abortMigration, asyncJob);
if (rv != 0) {
if (rv < 0) {
if (!err)
virObjectUnref(job);
}
- while ((rv = qemuMigrationSrcNBDCopyCancelled(vm, asyncJob, check)) != 1) {
- if (check && !failed &&
+ while ((rv = qemuMigrationSrcNBDCopyCancelled(vm, asyncJob, abortMigration)) != 1) {
+ if (!abortMigration && !failed &&
dconn && virConnectIsAlive(dconn) <= 0) {
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("Lost connection to destination host"));
}
if (mig->nbd &&
- qemuMigrationSrcNBDCopyCancel(driver, vm, true,
+ qemuMigrationSrcNBDCopyCancel(driver, vm, false,
QEMU_ASYNC_JOB_MIGRATION_OUT,
dconn) < 0)
goto error;
/* cancel any outstanding NBD jobs */
if (mig && mig->nbd)
- qemuMigrationSrcNBDCopyCancel(driver, vm, false,
+ qemuMigrationSrcNBDCopyCancel(driver, vm, true,
QEMU_ASYNC_JOB_MIGRATION_OUT,
dconn);
}
if (storage &&
- qemuMigrationSrcNBDCopyCancel(driver, vm, false,
+ qemuMigrationSrcNBDCopyCancel(driver, vm, true,
QEMU_ASYNC_JOB_NONE, NULL) < 0)
return -1;