mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 22:55:23 +00:00
qemu: blockjob: Re-enable bitmaps after failed block-commit
If a block-commit fails we should at least re-enable the bitmaps so that the operation can be re-tried. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
db450a7422
commit
4a39b25c81
@ -1345,6 +1345,40 @@ qemuBlockJobProcessEventFailedActiveCommit(virQEMUDriverPtr driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
qemuBlockJobProcessEventFailedCommitCommon(virDomainObjPtr vm,
|
||||||
|
qemuBlockJobDataPtr job,
|
||||||
|
qemuDomainAsyncJob asyncJob)
|
||||||
|
{
|
||||||
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
|
g_autoptr(virJSONValue) actions = virJSONValueNewArray();
|
||||||
|
char **disabledBitmaps = job->data.commit.disabledBitmapsBase;
|
||||||
|
|
||||||
|
if (!disabledBitmaps || !*disabledBitmaps)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (; *disabledBitmaps; disabledBitmaps++) {
|
||||||
|
qemuMonitorTransactionBitmapEnable(actions,
|
||||||
|
job->data.commit.base->nodeformat,
|
||||||
|
*disabledBitmaps);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (qemuBlockReopenReadWrite(vm, job->data.commit.base, asyncJob) < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
qemuMonitorTransaction(priv->mon, &actions);
|
||||||
|
|
||||||
|
if (qemuDomainObjExitMonitor(priv->driver, vm) < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (qemuBlockReopenReadOnly(vm, job->data.commit.base, asyncJob) < 0)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
qemuBlockJobProcessEventConcludedCreate(virQEMUDriverPtr driver,
|
qemuBlockJobProcessEventConcludedCreate(virQEMUDriverPtr driver,
|
||||||
virDomainObjPtr vm,
|
virDomainObjPtr vm,
|
||||||
@ -1452,13 +1486,17 @@ qemuBlockJobEventProcessConcludedTransition(qemuBlockJobDataPtr job,
|
|||||||
case QEMU_BLOCKJOB_TYPE_COMMIT:
|
case QEMU_BLOCKJOB_TYPE_COMMIT:
|
||||||
if (success)
|
if (success)
|
||||||
qemuBlockJobProcessEventCompletedCommit(driver, vm, job, asyncJob);
|
qemuBlockJobProcessEventCompletedCommit(driver, vm, job, asyncJob);
|
||||||
|
else
|
||||||
|
qemuBlockJobProcessEventFailedCommitCommon(vm, job, asyncJob);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT:
|
case QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT:
|
||||||
if (success)
|
if (success) {
|
||||||
qemuBlockJobProcessEventCompletedActiveCommit(driver, vm, job, asyncJob);
|
qemuBlockJobProcessEventCompletedActiveCommit(driver, vm, job, asyncJob);
|
||||||
else
|
} else {
|
||||||
qemuBlockJobProcessEventFailedActiveCommit(driver, vm, job);
|
qemuBlockJobProcessEventFailedActiveCommit(driver, vm, job);
|
||||||
|
qemuBlockJobProcessEventFailedCommitCommon(vm, job, asyncJob);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QEMU_BLOCKJOB_TYPE_CREATE:
|
case QEMU_BLOCKJOB_TYPE_CREATE:
|
||||||
|
Loading…
Reference in New Issue
Block a user