aboutsummaryrefslogtreecommitdiff
path: root/blockdev.c
diff options
context:
space:
mode:
authorWenchao Xia <xiawenc@linux.vnet.ibm.com>2013-05-08 18:25:15 +0800
committerStefan Hajnoczi <stefanha@redhat.com>2013-05-24 16:17:55 +0200
commit96b86bf72de0c6eda2799201517ef32910beb340 (patch)
tree21d7735942f3f98b3009c99db2a00027d63ed463 /blockdev.c
parent3b0047e86a1c215d830b1ae1da0778db4636b83a (diff)
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>
Diffstat (limited to 'blockdev.c')
-rw-r--r--blockdev.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/blockdev.c b/blockdev.c
index 76f053219a..2131e134ba 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -882,6 +882,13 @@ static void external_snapshot_commit(BlkTransactionStates *states)
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
* 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
*/
QSIMPLEQ_FOREACH(states, &snap_bdrv_states, entry) {
- if (states->new_bs) {
- bdrv_delete(states->new_bs);
- }
+ external_snapshot_abort(states);
}
exit:
QSIMPLEQ_FOREACH_SAFE(states, &snap_bdrv_states, entry, next) {