Commit 1ad3f806 authored by Helen Koike's avatar Helen Koike

wip: mirror

parent 43d9c978
......@@ -28,12 +28,13 @@ fill_rootfs()
sudo chmod +x dm-mount/bin/init.sh
}
create_snap()
create_snap_mirror()
{
# Create disk
DISK=$1
PREFIX=$2
DM_DEV=dm-snap
TYPE=${3-snap}
DM_DEV=dm-${TYPE}
if [ -f $DISK -a -f ${DISK}.info ]; then
echo "$DISK already exist, not creating it"
return
......@@ -41,11 +42,13 @@ create_snap()
echo "creating $DISK"
fi
dd if=/dev/zero of=$DISK bs=256M count=2
dd if=/dev/zero of=$DISK bs=256M count=3
# Partition 1
sudo sgdisk -n 1:0:+200M -t 1:7f01 "$DISK"
# Partition 2
sudo sgdisk -n 2:0:+200M -t 2:7f01 "$DISK"
# Partition 3
sudo sgdisk -n 3:0:+200M -t 2:7f01 "$DISK"
LOOP_DEV=$(sudo losetup -fP --show $DISK)
sectors=$(sudo blockdev --getsz "${LOOP_DEV}"p1)
......@@ -53,15 +56,16 @@ create_snap()
${PREFIX}sectors=${sectors}
EOF
sudo mkfs.ext4 -L ROOT-SNAP ${LOOP_DEV}p1
sudo mkfs.ext4 -L ROOT-${TYPE} ${LOOP_DEV}p1
mkdir -p dm-mount
sudo mount ${LOOP_DEV}p1 dm-mount
fill_rootfs "snap disk $DISK"
fill_rootfs "${TYPE} disk $DISK"
# Umount disk/dm/loopback
sudo umount dm-mount
rm -r dm-mount
sudo losetup -d $LOOP_DEV
}
create_raid()
......@@ -632,6 +636,21 @@ launch_test \
"dm-snap,,,ro,0 ${DSN1_sectors} snapshot-merge 8:1 8:2 P 8"
}
mirror_tests()
{
launch_test \
"mirror: core" \
"-hda ${DM1}" \
/dev/dm-4 \
"dm-mirror-core,,4,ro,0 ${DM1_sectors} mirror core 1 1024 2 /dev/sda1 0 /dev/sda2 0 1 handle_errors"
launch_test \
"mirror: disk" \
"-hda ${DM1}" \
/dev/dm-4 \
"dm-mirror-disk,,4,ro,0 ${DM1_sectors} mirror disk 2 /dev/sda3 1024 2 /dev/sda1 0 /dev/sda2 0 1 handle_errors"
}
DR41=disk-raid4-1.img
create_raid $DR41 DR41_ raid4
# Load disk info
......@@ -673,13 +692,19 @@ create_crypt $DC1 DC1_
source ${DC1}.info
DSN1=disk-snap-1.img
create_snap $DSN1 DSN1_
create_snap_mirror $DSN1 DSN1_
# Load disk info
source ${DSN1}.info
DM1=disk-mirror-1.img
create_snap_mirror $DM1 DM1_
# Load disk info
source ${DM1}.info
verity_tests
linear_parser_tests
striped_tests
crypt_tests
raid_tests
snap_tests
mirror_tests
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment