mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-04-01 20:05:19 +00:00
qemu: blockjob: Handle bitmaps after finish of normal block-commit
Merge the bitmaps into base of the block commit after the job finishes. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
8502b4b059
commit
db450a7422
@ -1049,6 +1049,55 @@ qemuBlockJobDeleteImages(virQEMUDriverPtr driver,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* qemuBlockJobProcessEventCompletedCommitBitmaps:
|
||||
*
|
||||
* Handles the bitmap changes after commit. This returns -1 on monitor failures.
|
||||
*/
|
||||
static int
|
||||
qemuBlockJobProcessEventCompletedCommitBitmaps(virDomainObjPtr vm,
|
||||
qemuBlockJobDataPtr job,
|
||||
qemuDomainAsyncJob asyncJob)
|
||||
{
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
g_autoptr(virHashTable) blockNamedNodeData = NULL;
|
||||
g_autoptr(virJSONValue) actions = NULL;
|
||||
|
||||
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN))
|
||||
return 0;
|
||||
|
||||
if (!(blockNamedNodeData = qemuBlockGetNamedNodeData(vm, asyncJob)))
|
||||
return -1;
|
||||
|
||||
if (qemuBlockBitmapsHandleCommitFinish(job->data.commit.top,
|
||||
job->data.commit.base,
|
||||
blockNamedNodeData,
|
||||
&actions,
|
||||
job->data.commit.disabledBitmapsBase) < 0)
|
||||
return 0;
|
||||
|
||||
if (!actions)
|
||||
return 0;
|
||||
|
||||
if (qemuBlockReopenReadWrite(vm, job->data.commit.base, asyncJob) < 0)
|
||||
return -1;
|
||||
|
||||
if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0)
|
||||
return -1;
|
||||
|
||||
qemuMonitorTransaction(priv->mon, &actions);
|
||||
|
||||
if (qemuDomainObjExitMonitor(priv->driver, vm) < 0)
|
||||
return -1;
|
||||
|
||||
if (qemuBlockReopenReadOnly(vm, job->data.commit.base, asyncJob) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* qemuBlockJobProcessEventCompletedCommit:
|
||||
* @driver: qemu driver object
|
||||
@ -1106,6 +1155,9 @@ qemuBlockJobProcessEventCompletedCommit(virQEMUDriverPtr driver,
|
||||
if (!n)
|
||||
return;
|
||||
|
||||
if (qemuBlockJobProcessEventCompletedCommitBitmaps(vm, job, asyncJob) < 0)
|
||||
return;
|
||||
|
||||
/* revert access to images */
|
||||
qemuDomainStorageSourceAccessAllow(driver, vm, job->data.commit.base,
|
||||
true, false, false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user