Merge tag 'qemu-macppc-20230206' of https://github.com/mcayland/qemu into staging
[qemu.git] / tests / qemu-iotests / sample_images / parallels-with-bitmap.sh
blob30615aa6bd31a00286e882920ec55725217ee4ad
1 #!/bin/bash
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/>.
21 CT=parallels-with-bitmap-ct
22 DIR=$PWD/parallels-with-bitmap-dir
23 IMG=$DIR/root.hds
24 XML=$DIR/DiskDescriptor.xml
25 TARGET=parallels-with-bitmap.bz2
27 rm -rf $DIR
29 prlctl create $CT --vmtype ct
30 prlctl set $CT --device-add hdd --image $DIR --recreate --size 2G
32 # cleanup the image
33 qemu-img create -f parallels $IMG 64G
35 # create bitmap
36 prlctl backup $CT
38 prlctl set $CT --device-del hdd1
39 prlctl destroy $CT
41 dev=$(ploop mount $XML | sed -n 's/^Adding delta dev=\(\/dev\/ploop[0-9]\+\).*/\1/p')
42 dd if=/dev/zero of=$dev bs=64K seek=5 count=2 oflag=direct
43 dd if=/dev/zero of=$dev bs=64K seek=30 count=1 oflag=direct
44 dd if=/dev/zero of=$dev bs=64K seek=10 count=3 oflag=direct
45 ploop umount $XML # bitmap name will be in the output
47 bzip2 -z $IMG
49 mv $IMG.bz2 $TARGET
51 rm -rf $DIR