[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH v4 20/20] iotests: add incremental backup failure re
From: |
John Snow |
Subject: |
[Qemu-block] [PATCH v4 20/20] iotests: add incremental backup failure recovery test |
Date: |
Fri, 20 Mar 2015 15:17:03 -0400 |
Test the failure case for incremental backups.
Signed-off-by: John Snow <address@hidden>
---
blockdev.c | 1 -
tests/qemu-iotests/124 | 55 ++++++++++++++++++++++++++++++++++++++++++++++
tests/qemu-iotests/124.out | 4 ++--
3 files changed, 57 insertions(+), 3 deletions(-)
diff --git a/blockdev.c b/blockdev.c
index b9c79ed..ab67b4d 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1218,7 +1218,6 @@ static BdrvDirtyBitmap *block_dirty_bitmap_lookup(const
char *node,
} else {
aio_context_release(aio_context);
}
-
return bitmap;
fail:
diff --git a/tests/qemu-iotests/124 b/tests/qemu-iotests/124
index ce2cda7..d16d2c2 100644
--- a/tests/qemu-iotests/124
+++ b/tests/qemu-iotests/124
@@ -226,6 +226,61 @@ class TestIncrementalBackup(iotests.QMPTestCase):
return True
+ def test_incremental_failure(self):
+ '''Test: Verify backups made after a failure are correct.
+
+ Simulate a failure during an incremental backup block job,
+ emulate additional writes, then create another incremental backup
+ afterwards and verify that the backup created is correct.
+ '''
+
+ # Create a blkdebug interface to this img as 'drive1',
+ # but don't actually create a new image.
+ drive1 = self.add_node('drive1', self.drives[0]['fmt'],
+ path=self.drives[0]['file'],
+ backup=self.drives[0]['backup'])
+ result = self.vm.qmp('blockdev-add', options={
+ 'id': drive1['id'],
+ 'driver': drive1['fmt'],
+ 'file': {
+ 'driver': 'blkdebug',
+ 'image': {
+ 'driver': 'file',
+ 'filename': drive1['file']
+ },
+ 'set-state': [{
+ 'event': 'flush_to_disk',
+ 'state': 1,
+ 'new_state': 2
+ }],
+ 'inject-error': [{
+ 'event': 'read_aio',
+ 'errno': 5,
+ 'state': 2,
+ 'immediately': False,
+ 'once': True
+ }],
+ }
+ })
+ self.assert_qmp(result, 'return', {})
+
+ self.create_full_backup(self.drives[0])
+ self.add_bitmap('bitmap0', drive1)
+ # Note: at this point, during a normal execution,
+ # Assume that the VM resumes and begins issuing IO requests here.
+
+ self.hmp_io_writes(drive1['id'], (('0xab', 0, 512),
+ ('0xfe', '16M', '256k'),
+ ('0x64', '32736k', '64k')))
+
+ result = self.create_incremental(validate=False)
+ self.assertFalse(result)
+ self.hmp_io_writes(drive1['id'], (('0x9a', 0, 512),
+ ('0x55', '8M', '352k'),
+ ('0x78', '15872k', '1M')))
+ self.create_incremental()
+
+
def test_sync_dirty_bitmap_missing(self):
self.assert_no_active_block_jobs()
self.files.append(self.err_img)
diff --git a/tests/qemu-iotests/124.out b/tests/qemu-iotests/124.out
index 8d7e996..89968f3 100644
--- a/tests/qemu-iotests/124.out
+++ b/tests/qemu-iotests/124.out
@@ -1,5 +1,5 @@
-...
+....
----------------------------------------------------------------------
-Ran 3 tests
+Ran 4 tests
OK
--
2.1.0
- [Qemu-block] [PATCH v4 10/20] qmp: Add support of "dirty-bitmap" sync mode for drive-backup, (continued)
- [Qemu-block] [PATCH v4 10/20] qmp: Add support of "dirty-bitmap" sync mode for drive-backup, John Snow, 2015/03/20
- [Qemu-block] [PATCH v4 15/20] block: Resize bitmaps on bdrv_truncate, John Snow, 2015/03/20
- [Qemu-block] [PATCH v4 17/20] iotests: add invalid input incremental backup tests, John Snow, 2015/03/20
- [Qemu-block] [PATCH v4 13/20] block: add BdrvDirtyBitmap documentation, John Snow, 2015/03/20
- [Qemu-block] [PATCH v4 18/20] iotests: add QMP event waiting queue, John Snow, 2015/03/20
- [Qemu-block] [PATCH v4 16/20] hbitmap: truncate tests, John Snow, 2015/03/20
- [Qemu-block] [PATCH v4 11/20] qmp: add block-dirty-bitmap-clear, John Snow, 2015/03/20
- [Qemu-block] [PATCH v4 12/20] qmp: Add dirty bitmap status field in query-block, John Snow, 2015/03/20
- [Qemu-block] [PATCH v4 20/20] iotests: add incremental backup failure recovery test,
John Snow <=
- [Qemu-block] [PATCH v4 19/20] iotests: add simple incremental backup case, John Snow, 2015/03/20
- [Qemu-block] [PATCH v4 14/20] block: Ensure consistent bitmap function prototypes, John Snow, 2015/03/20
- Re: [Qemu-block] [PATCH v4 00/20] block: transactionless incremental backup series, Max Reitz, 2015/03/20