[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 11/20] blockdev: add Abort transaction
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 11/20] blockdev: add Abort transaction |
Date: |
Fri, 28 Jun 2013 16:25:00 +0200 |
From: Stefan Hajnoczi <address@hidden>
The Abort action can be used to test QMP 'transaction' failure. Add it
as the last action to exercise the .abort() and .cleanup() code paths
for all previous actions.
Reviewed-by: Kevin Wolf <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
blockdev.c | 15 +++++++++++++++
qapi-schema.json | 13 ++++++++++++-
2 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/blockdev.c b/blockdev.c
index 6200c0d..b3a57e0 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -963,6 +963,16 @@ static void drive_backup_abort(BlkTransactionState *common)
}
}
+static void abort_prepare(BlkTransactionState *common, Error **errp)
+{
+ error_setg(errp, "Transaction aborted using Abort action");
+}
+
+static void abort_commit(BlkTransactionState *common)
+{
+ assert(false); /* this action never succeeds */
+}
+
static const BdrvActionOps actions[] = {
[TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT_SYNC] = {
.instance_size = sizeof(ExternalSnapshotState),
@@ -975,6 +985,11 @@ static const BdrvActionOps actions[] = {
.prepare = drive_backup_prepare,
.abort = drive_backup_abort,
},
+ [TRANSACTION_ACTION_KIND_ABORT] = {
+ .instance_size = sizeof(BlkTransactionState),
+ .prepare = abort_prepare,
+ .commit = abort_commit,
+ },
};
/*
diff --git a/qapi-schema.json b/qapi-schema.json
index 714108d..6590307 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -1660,6 +1660,16 @@
'*on-target-error': 'BlockdevOnError' } }
##
+# @Abort
+#
+# This action can be used to test transaction failure.
+#
+# Since: 1.6
+###
+{ 'type': 'Abort',
+ 'data': { } }
+
+##
# @TransactionAction
#
# A discriminated record of operations that can be performed with
@@ -1668,7 +1678,8 @@
{ 'union': 'TransactionAction',
'data': {
'blockdev-snapshot-sync': 'BlockdevSnapshot',
- 'drive-backup': 'DriveBackup'
+ 'drive-backup': 'DriveBackup',
+ 'abort': 'Abort'
} }
##
--
1.8.1.4
- [Qemu-devel] [PULL 01/20] raw-posix: Fix /dev/cdrom magic on OS X, (continued)
- [Qemu-devel] [PULL 01/20] raw-posix: Fix /dev/cdrom magic on OS X, Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 02/20] notify: add NotiferWithReturn so notifier list can abort, Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 03/20] block: add bdrv_add_before_write_notifier(), Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 06/20] blockdev: use bdrv_getlength() in qmp_drive_mirror(), Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 04/20] block: add basic backup support to block driver, Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 05/20] blockdev: drop redundant proto_drv check, Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 09/20] blockdev: allow BdrvActionOps->commit() to be NULL, Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 07/20] block: add drive-backup QMP command, Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 10/20] blockdev: add DriveBackup transaction, Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 08/20] blockdev: rename BlkTransactionStates to singular, Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 11/20] blockdev: add Abort transaction,
Kevin Wolf <=
- [Qemu-devel] [PULL 12/20] qemu-iotests: extract wait_until_completed() into iotests.py, Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 15/20] block/ssh: Set bdrv_has_zero_init according to the file type., Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 13/20] qemu-iotests: add 055 drive-backup test case, Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 14/20] block: Make BlockJobTypes const, Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 16/20] gluster: Return bdrv_has_zero_init = 0, Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 18/20] vpc: Implement .bdrv_has_zero_init, Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 19/20] block: change default of .has_zero_init to 0, Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 20/20] cmd646: fix build when DEBUG_IDE is enabled., Kevin Wolf, 2013/06/28
- [Qemu-devel] [PULL 17/20] vmdk: remove wrong calculation of relative path, Kevin Wolf, 2013/06/28