Am 18.04.2015 um 01:50 hat John Snow geschrieben: > Test the failure case for incremental backups. > > Signed-off-by: John Snow <[email protected]> > Reviewed-by: Max Reitz <[email protected]> > --- > tests/qemu-iotests/124 | 57 > ++++++++++++++++++++++++++++++++++++++++++++++ > tests/qemu-iotests/124.out | 4 ++-- > 2 files changed, 59 insertions(+), 2 deletions(-) > > diff --git a/tests/qemu-iotests/124 b/tests/qemu-iotests/124 > index 5c3b434..95f6de5 100644 > --- a/tests/qemu-iotests/124 > +++ b/tests/qemu-iotests/124 > @@ -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', {})
John, how naughty of you! It's interesting how many tests break now that I tried to add some advisory qcow2 locking so that people don't constantly break their images with 'qemu-img snapshot' while the VM is running. I think this one is a bug in the test case. I'm not completely sure how to fix it, though. Can we move the blkdebug layer to the top level? I think reusing the same qcow2 BDS (using a node name reference) would be okay. We just need to avoid opening the qcow2 layer twice for the same image. Kevin
