1#!/bin/bash 2# 3# Test parallels load bitmap 4# 5# Copyright (c) 2021 Virtuozzo International GmbH. 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 21CT=parallels-with-bitmap-ct 22DIR=$PWD/parallels-with-bitmap-dir 23IMG=$DIR/root.hds 24XML=$DIR/DiskDescriptor.xml 25TARGET=parallels-with-bitmap.bz2 26 27rm -rf $DIR 28 29prlctl create $CT --vmtype ct 30prlctl set $CT --device-add hdd --image $DIR --recreate --size 2G 31 32# cleanup the image 33qemu-img create -f parallels $IMG 64G 34 35# create bitmap 36prlctl backup $CT 37 38prlctl set $CT --device-del hdd1 39prlctl destroy $CT 40 41dev=$(ploop mount $XML | sed -n 's/^Adding delta dev=\(\/dev\/ploop[0-9]\+\).*/\1/p') 42dd if=/dev/zero of=$dev bs=64K seek=5 count=2 oflag=direct 43dd if=/dev/zero of=$dev bs=64K seek=30 count=1 oflag=direct 44dd if=/dev/zero of=$dev bs=64K seek=10 count=3 oflag=direct 45ploop umount $XML # bitmap name will be in the output 46 47bzip2 -z $IMG 48 49mv $IMG.bz2 $TARGET 50 51rm -rf $DIR 52