549fb88045
Test fails at least for qcow, because of different cluster sizes in base and top (and therefore different granularities of bitmaps we are trying to merge). The test aim is to check block-dirty-bitmap-merge between different nodes functionality, no needs to check all formats. So, let's just drop support for anything except qcow2. Reported-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-id: 20190605155405.104384-1-vsementsov@virtuozzo.com Signed-off-by: Max Reitz <mreitz@redhat.com>
55 lines
1.9 KiB
Python
Executable File
55 lines
1.9 KiB
Python
Executable File
#!/usr/bin/env python
|
|
#
|
|
# Test external snapshot with bitmap copying.
|
|
#
|
|
# Copyright (c) 2019 Virtuozzo International GmbH. All rights reserved.
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
#
|
|
|
|
import iotests
|
|
from iotests import qemu_img_create, file_path, log
|
|
|
|
iotests.verify_image_format(supported_fmts=['qcow2'])
|
|
|
|
disk, top = file_path('disk', 'top')
|
|
size = 1024 * 1024
|
|
|
|
qemu_img_create('-f', iotests.imgfmt, disk, str(size))
|
|
|
|
vm = iotests.VM().add_drive(disk, opts='node-name=base')
|
|
vm.launch()
|
|
|
|
vm.qmp_log('block-dirty-bitmap-add', node='drive0', name='bitmap0')
|
|
|
|
vm.hmp_qemu_io('drive0', 'write 0 512K')
|
|
|
|
vm.qmp_log('transaction', indent=2, actions=[
|
|
{'type': 'blockdev-snapshot-sync',
|
|
'data': {'device': 'drive0', 'snapshot-file': top,
|
|
'snapshot-node-name': 'snap'}},
|
|
{'type': 'block-dirty-bitmap-add',
|
|
'data': {'node': 'snap', 'name': 'bitmap0'}},
|
|
{'type': 'block-dirty-bitmap-merge',
|
|
'data': {'node': 'snap', 'target': 'bitmap0',
|
|
'bitmaps': [{'node': 'base', 'name': 'bitmap0'}]}}
|
|
], filters=[iotests.filter_qmp_testfiles])
|
|
|
|
result = vm.qmp('query-block')['return'][0]
|
|
log("query-block: device = {}, node-name = {}, dirty-bitmaps:".format(
|
|
result['device'], result['inserted']['node-name']))
|
|
log(result['dirty-bitmaps'], indent=2)
|
|
|
|
vm.shutdown()
|