mirror of https://gitee.com/openkylin/qemu.git
iotests: add incremental backup failure recovery test
Test the failure case for incremental backups. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1429314609-29776-21-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
a3d715958c
commit
24618f5381
|
@ -240,6 +240,63 @@ class TestIncrementalBackup(iotests.QMPTestCase):
|
|||
self.check_backups()
|
||||
|
||||
|
||||
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_anchor_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()
|
||||
self.vm.shutdown()
|
||||
self.check_backups()
|
||||
|
||||
|
||||
def test_sync_dirty_bitmap_missing(self):
|
||||
self.assert_no_active_block_jobs()
|
||||
self.files.append(self.err_img)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
...
|
||||
....
|
||||
----------------------------------------------------------------------
|
||||
Ran 3 tests
|
||||
Ran 4 tests
|
||||
|
||||
OK
|
||||
|
|
Loading…
Reference in New Issue