qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

iotests: add 248: test resume mirror after auto pause on ENOSPC

Test that mirror job actually resume on resume command after being
automatically paused on ENOSPC error.

It's a follow-up test for 8d9648cbf3e
"blockjob: fix user pause in block_job_error_action"

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Tested-by: John Snow <jsnow@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>

authored by

Vladimir Sementsov-Ogievskiy and committed by
Kevin Wolf
a66c4b83 527266f3

+80
+71
tests/qemu-iotests/248
··· 1 + #!/usr/bin/env python 2 + # 3 + # Test resume mirror after auto pause on ENOSPC 4 + # 5 + # Copyright (c) 2019 Virtuozzo International GmbH. All rights reserved. 6 + # 7 + # This program is free software; you can redistribute it and/or modify 8 + # it under the terms of the GNU General Public License as published by 9 + # the Free Software Foundation; either version 2 of the License, or 10 + # (at your option) any later version. 11 + # 12 + # This program is distributed in the hope that it will be useful, 13 + # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 + # GNU General Public License for more details. 16 + # 17 + # You should have received a copy of the GNU General Public License 18 + # along with this program. If not, see <http://www.gnu.org/licenses/>. 19 + # 20 + 21 + import iotests 22 + from iotests import qemu_img_create, qemu_io, file_path, filter_qmp_testfiles 23 + 24 + iotests.verify_image_format(supported_fmts=['qcow2']) 25 + 26 + source, target = file_path('source', 'target') 27 + size = 5 * 1024 * 1024 28 + limit = 2 * 1024 * 1024 29 + 30 + qemu_img_create('-f', iotests.imgfmt, source, str(size)) 31 + qemu_img_create('-f', iotests.imgfmt, target, str(size)) 32 + qemu_io('-c', 'write 0 {}'.format(size), source) 33 + 34 + # raw format don't like empty files 35 + qemu_io('-c', 'write 0 {}'.format(size), target) 36 + 37 + vm = iotests.VM().add_drive(source) 38 + vm.launch() 39 + 40 + blockdev_opts = { 41 + 'driver': iotests.imgfmt, 42 + 'node-name': 'target', 43 + 'file': { 44 + 'driver': 'raw', 45 + 'size': limit, 46 + 'file': { 47 + 'driver': 'file', 48 + 'filename': target 49 + } 50 + } 51 + } 52 + vm.qmp_log('blockdev-add', filters=[filter_qmp_testfiles], **blockdev_opts) 53 + 54 + vm.qmp_log('blockdev-mirror', device='drive0', sync='full', target='target', 55 + on_target_error='enospc') 56 + 57 + vm.event_wait('JOB_STATUS_CHANGE', timeout=3.0, 58 + match={'data': {'status': 'paused'}}) 59 + 60 + # drop other cached events, to not interfere with further wait for 'running' 61 + vm.get_qmp_events() 62 + 63 + del blockdev_opts['file']['size'] 64 + vm.qmp_log('x-blockdev-reopen', filters=[filter_qmp_testfiles], 65 + **blockdev_opts) 66 + 67 + vm.qmp_log('block-job-resume', device='drive0') 68 + vm.event_wait('JOB_STATUS_CHANGE', timeout=1.0, 69 + match={'data': {'status': 'running'}}) 70 + 71 + vm.shutdown()
+8
tests/qemu-iotests/248.out
··· 1 + {"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"driver": "raw", "file": {"driver": "file", "filename": "TEST_DIR/PID-target"}, "size": 2097152}, "node-name": "target"}} 2 + {"return": {}} 3 + {"execute": "blockdev-mirror", "arguments": {"device": "drive0", "on-target-error": "enospc", "sync": "full", "target": "target"}} 4 + {"return": {}} 5 + {"execute": "x-blockdev-reopen", "arguments": {"driver": "qcow2", "file": {"driver": "raw", "file": {"driver": "file", "filename": "TEST_DIR/PID-target"}}, "node-name": "target"}} 6 + {"return": {}} 7 + {"execute": "block-job-resume", "arguments": {"device": "drive0"}} 8 + {"return": {}}
+1
tests/qemu-iotests/group
··· 246 246 245 rw auto 247 247 246 rw auto quick 248 248 247 rw auto quick 249 + 248 rw auto quick