|
|
7711c0 |
From 5252d9e158007252f01fb6de28e22918741e6f8e Mon Sep 17 00:00:00 2001
|
|
|
7711c0 |
From: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
Date: Wed, 3 Apr 2019 18:18:48 +0200
|
|
|
7711c0 |
Subject: [PATCH 143/163] iotests: add busy/recording bit test to 124
|
|
|
7711c0 |
|
|
|
7711c0 |
RH-Author: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
Message-id: <20190403181857.9693-13-jsnow@redhat.com>
|
|
|
7711c0 |
Patchwork-id: 85423
|
|
|
7711c0 |
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH 12/21] iotests: add busy/recording bit test to 124
|
|
|
7711c0 |
Bugzilla: 1677073
|
|
|
7711c0 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
7711c0 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
7711c0 |
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
|
|
|
7711c0 |
|
|
|
7711c0 |
This adds a simple test that ensures the busy bit works for push backups,
|
|
|
7711c0 |
as well as doubling as bonus test for incremental backups that get interrupted
|
|
|
7711c0 |
by EIO errors.
|
|
|
7711c0 |
|
|
|
7711c0 |
Recording bit tests are already handled sufficiently by 236.
|
|
|
7711c0 |
|
|
|
7711c0 |
Signed-off-by: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
7711c0 |
Tested-by: Eric Blake <eblake@redhat.com>
|
|
|
7711c0 |
Message-id: 20190223000614.13894-11-jsnow@redhat.com
|
|
|
7711c0 |
Signed-off-by: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
(cherry picked from commit c61b198b63219b489908c87371acae8c986ce4d3)
|
|
|
7711c0 |
Signed-off-by: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
7711c0 |
---
|
|
|
7711c0 |
tests/qemu-iotests/124 | 113 +++++++++++++++++++++++++++++++++++++++++++++
|
|
|
7711c0 |
tests/qemu-iotests/124.out | 4 +-
|
|
|
7711c0 |
2 files changed, 115 insertions(+), 2 deletions(-)
|
|
|
7711c0 |
|
|
|
7711c0 |
diff --git a/tests/qemu-iotests/124 b/tests/qemu-iotests/124
|
|
|
7711c0 |
index 439a86a..acfe04e 100755
|
|
|
7711c0 |
--- a/tests/qemu-iotests/124
|
|
|
7711c0 |
+++ b/tests/qemu-iotests/124
|
|
|
7711c0 |
@@ -634,6 +634,119 @@ class TestIncrementalBackupBlkdebug(TestIncrementalBackupBase):
|
|
|
7711c0 |
self.vm.shutdown()
|
|
|
7711c0 |
self.check_backups()
|
|
|
7711c0 |
|
|
|
7711c0 |
+ def test_incremental_pause(self):
|
|
|
7711c0 |
+ """
|
|
|
7711c0 |
+ Test an incremental backup that errors into a pause and is resumed.
|
|
|
7711c0 |
+ """
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+ drive0 = self.drives[0]
|
|
|
7711c0 |
+ # NB: The blkdebug script here looks for a "flush, read, read" pattern.
|
|
|
7711c0 |
+ # The flush occurs in hmp_io_writes, the first read in device_add, and
|
|
|
7711c0 |
+ # the last read during the block job.
|
|
|
7711c0 |
+ result = self.vm.qmp('blockdev-add',
|
|
|
7711c0 |
+ node_name=drive0['id'],
|
|
|
7711c0 |
+ driver=drive0['fmt'],
|
|
|
7711c0 |
+ file={
|
|
|
7711c0 |
+ 'driver': 'blkdebug',
|
|
|
7711c0 |
+ 'image': {
|
|
|
7711c0 |
+ 'driver': 'file',
|
|
|
7711c0 |
+ 'filename': drive0['file']
|
|
|
7711c0 |
+ },
|
|
|
7711c0 |
+ 'set-state': [{
|
|
|
7711c0 |
+ 'event': 'flush_to_disk',
|
|
|
7711c0 |
+ 'state': 1,
|
|
|
7711c0 |
+ 'new_state': 2
|
|
|
7711c0 |
+ },{
|
|
|
7711c0 |
+ 'event': 'read_aio',
|
|
|
7711c0 |
+ 'state': 2,
|
|
|
7711c0 |
+ 'new_state': 3
|
|
|
7711c0 |
+ }],
|
|
|
7711c0 |
+ 'inject-error': [{
|
|
|
7711c0 |
+ 'event': 'read_aio',
|
|
|
7711c0 |
+ 'errno': 5,
|
|
|
7711c0 |
+ 'state': 3,
|
|
|
7711c0 |
+ 'immediately': False,
|
|
|
7711c0 |
+ 'once': True
|
|
|
7711c0 |
+ }],
|
|
|
7711c0 |
+ })
|
|
|
7711c0 |
+ self.assert_qmp(result, 'return', {})
|
|
|
7711c0 |
+ self.create_anchor_backup(drive0)
|
|
|
7711c0 |
+ bitmap = self.add_bitmap('bitmap0', drive0)
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+ # Emulate guest activity
|
|
|
7711c0 |
+ self.hmp_io_writes(drive0['id'], (('0xab', 0, 512),
|
|
|
7711c0 |
+ ('0xfe', '16M', '256k'),
|
|
|
7711c0 |
+ ('0x64', '32736k', '64k')))
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+ # For the purposes of query-block visibility of bitmaps, add a drive
|
|
|
7711c0 |
+ # frontend after we've written data; otherwise we can't use hmp-io
|
|
|
7711c0 |
+ result = self.vm.qmp("device_add",
|
|
|
7711c0 |
+ id="device0",
|
|
|
7711c0 |
+ drive=drive0['id'],
|
|
|
7711c0 |
+ driver="virtio-blk")
|
|
|
7711c0 |
+ self.assert_qmp(result, 'return', {})
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+ # Bitmap Status Check
|
|
|
7711c0 |
+ query = self.vm.qmp('query-block')
|
|
|
7711c0 |
+ ret = [bmap for bmap in query['return'][0]['dirty-bitmaps']
|
|
|
7711c0 |
+ if bmap.get('name') == bitmap.name][0]
|
|
|
7711c0 |
+ self.assert_qmp(ret, 'count', 458752)
|
|
|
7711c0 |
+ self.assert_qmp(ret, 'granularity', 65536)
|
|
|
7711c0 |
+ self.assert_qmp(ret, 'status', 'active')
|
|
|
7711c0 |
+ self.assert_qmp(ret, 'busy', False)
|
|
|
7711c0 |
+ self.assert_qmp(ret, 'recording', True)
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+ # Start backup
|
|
|
7711c0 |
+ parent, _ = bitmap.last_target()
|
|
|
7711c0 |
+ target = self.prepare_backup(bitmap, parent)
|
|
|
7711c0 |
+ res = self.vm.qmp('drive-backup',
|
|
|
7711c0 |
+ job_id=bitmap.drive['id'],
|
|
|
7711c0 |
+ device=bitmap.drive['id'],
|
|
|
7711c0 |
+ sync='incremental',
|
|
|
7711c0 |
+ bitmap=bitmap.name,
|
|
|
7711c0 |
+ format=bitmap.drive['fmt'],
|
|
|
7711c0 |
+ target=target,
|
|
|
7711c0 |
+ mode='existing',
|
|
|
7711c0 |
+ on_source_error='stop')
|
|
|
7711c0 |
+ self.assert_qmp(res, 'return', {})
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+ # Wait for the error
|
|
|
7711c0 |
+ event = self.vm.event_wait(name="BLOCK_JOB_ERROR",
|
|
|
7711c0 |
+ match={"data":{"device":bitmap.drive['id']}})
|
|
|
7711c0 |
+ self.assert_qmp(event, 'data', {'device': bitmap.drive['id'],
|
|
|
7711c0 |
+ 'action': 'stop',
|
|
|
7711c0 |
+ 'operation': 'read'})
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+ # Bitmap Status Check
|
|
|
7711c0 |
+ query = self.vm.qmp('query-block')
|
|
|
7711c0 |
+ ret = [bmap for bmap in query['return'][0]['dirty-bitmaps']
|
|
|
7711c0 |
+ if bmap.get('name') == bitmap.name][0]
|
|
|
7711c0 |
+ self.assert_qmp(ret, 'count', 458752)
|
|
|
7711c0 |
+ self.assert_qmp(ret, 'granularity', 65536)
|
|
|
7711c0 |
+ self.assert_qmp(ret, 'status', 'frozen')
|
|
|
7711c0 |
+ self.assert_qmp(ret, 'busy', True)
|
|
|
7711c0 |
+ self.assert_qmp(ret, 'recording', True)
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+ # Resume and check incremental backup for consistency
|
|
|
7711c0 |
+ res = self.vm.qmp('block-job-resume', device=bitmap.drive['id'])
|
|
|
7711c0 |
+ self.assert_qmp(res, 'return', {})
|
|
|
7711c0 |
+ self.wait_qmp_backup(bitmap.drive['id'])
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+ # Bitmap Status Check
|
|
|
7711c0 |
+ query = self.vm.qmp('query-block')
|
|
|
7711c0 |
+ ret = [bmap for bmap in query['return'][0]['dirty-bitmaps']
|
|
|
7711c0 |
+ if bmap.get('name') == bitmap.name][0]
|
|
|
7711c0 |
+ self.assert_qmp(ret, 'count', 0)
|
|
|
7711c0 |
+ self.assert_qmp(ret, 'granularity', 65536)
|
|
|
7711c0 |
+ self.assert_qmp(ret, 'status', 'active')
|
|
|
7711c0 |
+ self.assert_qmp(ret, 'busy', False)
|
|
|
7711c0 |
+ self.assert_qmp(ret, 'recording', True)
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+ # Finalize / Cleanup
|
|
|
7711c0 |
+ self.make_reference_backup(bitmap)
|
|
|
7711c0 |
+ self.vm.shutdown()
|
|
|
7711c0 |
+ self.check_backups()
|
|
|
7711c0 |
+
|
|
|
7711c0 |
|
|
|
7711c0 |
if __name__ == '__main__':
|
|
|
7711c0 |
iotests.main(supported_fmts=['qcow2'])
|
|
|
7711c0 |
diff --git a/tests/qemu-iotests/124.out b/tests/qemu-iotests/124.out
|
|
|
7711c0 |
index e56cae0..281b69e 100644
|
|
|
7711c0 |
--- a/tests/qemu-iotests/124.out
|
|
|
7711c0 |
+++ b/tests/qemu-iotests/124.out
|
|
|
7711c0 |
@@ -1,5 +1,5 @@
|
|
|
7711c0 |
-...........
|
|
|
7711c0 |
+............
|
|
|
7711c0 |
----------------------------------------------------------------------
|
|
|
7711c0 |
-Ran 11 tests
|
|
|
7711c0 |
+Ran 12 tests
|
|
|
7711c0 |
|
|
|
7711c0 |
OK
|
|
|
7711c0 |
--
|
|
|
7711c0 |
1.8.3.1
|
|
|
7711c0 |
|