3 # Test parallels load bitmap
5 # Copyright (c) 2021 Virtuozzo International GmbH.
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.
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.
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/>.
22 from iotests import qemu_nbd_popen, qemu_img_map, log, file_path
24 iotests.script_initialize(supported_fmts=['parallels'])
26 nbd_sock = file_path('nbd-sock', base_dir=iotests.sock_dir)
27 disk = iotests.file_path('disk')
28 bitmap = 'e4f2eed0-37fe-4539-b50b-85d2e7fd235f'
29 nbd_opts = f'driver=nbd,server.type=unix,server.path={nbd_sock}' \
30 f',x-dirty-bitmap=qemu:dirty-bitmap:{bitmap}'
33 iotests.unarchive_sample_image('parallels-with-bitmap', disk)
36 with qemu_nbd_popen('--read-only', f'--socket={nbd_sock}',
37 f'--bitmap={bitmap}', '-f', iotests.imgfmt, disk):
38 chunks = qemu_img_map('--image-opts', nbd_opts)
41 log('dirty clusters (cluster size is 64K):')
43 assert c['start'] % cluster == 0
44 assert c['length'] % cluster == 0
48 a = c['start'] // cluster
49 b = (c['start'] + c['length']) // cluster