mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-09-01 06:21:52 -06:00
block: package rollback code in qmp_transaction()
Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
3b0047e86a
commit
96b86bf72d
1 changed files with 8 additions and 3 deletions
11
blockdev.c
11
blockdev.c
|
@ -882,6 +882,13 @@ static void external_snapshot_commit(BlkTransactionStates *states)
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void external_snapshot_abort(BlkTransactionStates *states)
|
||||||
|
{
|
||||||
|
if (states->new_bs) {
|
||||||
|
bdrv_delete(states->new_bs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 'Atomic' group snapshots. The snapshots are taken as a set, and if any fail
|
* 'Atomic' group snapshots. The snapshots are taken as a set, and if any fail
|
||||||
* then we do not pivot any of the devices in the group, and abandon the
|
* then we do not pivot any of the devices in the group, and abandon the
|
||||||
|
@ -939,9 +946,7 @@ delete_and_fail:
|
||||||
* the original bs for all images
|
* the original bs for all images
|
||||||
*/
|
*/
|
||||||
QSIMPLEQ_FOREACH(states, &snap_bdrv_states, entry) {
|
QSIMPLEQ_FOREACH(states, &snap_bdrv_states, entry) {
|
||||||
if (states->new_bs) {
|
external_snapshot_abort(states);
|
||||||
bdrv_delete(states->new_bs);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
exit:
|
exit:
|
||||||
QSIMPLEQ_FOREACH_SAFE(states, &snap_bdrv_states, entry, next) {
|
QSIMPLEQ_FOREACH_SAFE(states, &snap_bdrv_states, entry, next) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue