1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
lvm2/test/shell/pe-align.sh
Zdenek Kabelac 5bd99d55b0 shellcheck: tests fixes
Correcting some shell problems.
2021-09-21 21:03:47 +02:00

143 lines
5.1 KiB
Bash

#!/usr/bin/env bash
# Copyright (C) 2014 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
test_description='Test pe alignment and metadata sizes'
SKIP_WITH_LVMPOLLD=1
. lib/inittest
aux prepare_devs 1
# values depend on page size 4K
# In order of strength:
# --dataalignmentoffset (modifies all below)
# --dataalignment (overrides all below)
# devices/data_alignment (overrides all below)
# devices/data_alignment_offset_detection (overrides all below)
# devices/md_chunk_alignment (overrides all below)
# devices/default_data_alignment
pvcreate "$dev1"
check pv_field "$dev1" pe_start 1.00m
check pv_field "$dev1" mda_size 1020.00k
pvremove "$dev1"
# default align at 1m is effective even with smaller requested metadata
pvcreate --metadatasize 100k "$dev1"
check pv_field "$dev1" pe_start 1.00m
check pv_field "$dev1" mda_size 1020.00k
pvremove "$dev1"
# default first pe doesn't depend on on these two settings
pvcreate --config 'devices {default_data_alignment=0 data_alignment=0}' "$dev1"
check pv_field "$dev1" pe_start 1.00m
check pv_field "$dev1" mda_size 1020.00k
pvremove "$dev1"
# same as previous
pvcreate --config 'devices {default_data_alignment=1 data_alignment=0}' "$dev1"
check pv_field "$dev1" pe_start 1.00m
check pv_field "$dev1" mda_size 1020.00k
pvremove "$dev1"
# same as previous
pvcreate --config 'devices {default_data_alignment=0 data_alignment=1024}' "$dev1"
check pv_field "$dev1" pe_start 1.00m
check pv_field "$dev1" mda_size 1020.00k
pvremove "$dev1"
# same as previous
pvcreate --config 'devices {default_data_alignment=1 data_alignment=1024}' "$dev1"
check pv_field "$dev1" pe_start 1.00m
check pv_field "$dev1" mda_size 1020.00k
pvremove "$dev1"
# combine above
pvcreate --metadatasize 100k --config 'devices {default_data_alignment=0 data_alignment=0}' "$dev1"
check pv_field "$dev1" pe_start 1.00m
check pv_field "$dev1" mda_size 1020.00k
pvremove "$dev1"
pvcreate --metadatasize 2048k "$dev1"
check pv_field "$dev1" pe_start 3072.00k --units k
check pv_field "$dev1" mda_size 3068.00k --units k
pvremove "$dev1"
pvcreate --metadatasize 2044k "$dev1"
check pv_field "$dev1" pe_start 2048.00k --units k
check pv_field "$dev1" mda_size 2044.00k --units k
pvremove "$dev1"
pvcreate --metadatasize 2048k --config 'devices {default_data_alignment=2}' "$dev1"
check pv_field "$dev1" pe_start 4.00m
check pv_field "$dev1" mda_size 4092.00k --units k
pvremove "$dev1"
pvcreate --metadatasize 100k --config 'devices {default_data_alignment=2}' "$dev1"
check pv_field "$dev1" pe_start 2048.00k --units k
check pv_field "$dev1" mda_size 2044.00k --units k
pvremove "$dev1"
pvcreate --metadatasize 2048k --dataalignment 128k "$dev1"
check pv_field "$dev1" pe_start 2176.00k --units k
check pv_field "$dev1" mda_size 2172.00k --units k
pvremove "$dev1"
pvcreate --metadatasize 2048k --dataalignment 128k --dataalignmentoffset 2k "$dev1"
check pv_field "$dev1" pe_start 2178.00k --units k
check pv_field "$dev1" mda_size 2174.00k --units k
pvremove "$dev1"
pvcreate --metadatasize 2048k --dataalignment 128k --config 'devices {default_data_alignment=0}' "$dev1"
check pv_field "$dev1" pe_start 2176.00k --units k
check pv_field "$dev1" mda_size 2172.00k --units k
pvremove "$dev1"
pvcreate --metadatasize 2048k --dataalignment 128k --config 'devices {default_data_alignment=2}' "$dev1"
check pv_field "$dev1" pe_start 2176.00k --units k
check pv_field "$dev1" mda_size 2172.00k --units k
pvremove "$dev1"
pvcreate --metadatasize 2048k --config 'devices {default_data_alignment=2 data_alignment=128}' "$dev1"
check pv_field "$dev1" pe_start 2176.00k --units k
check pv_field "$dev1" mda_size 2172.00k --units k
pvremove "$dev1"
pvcreate --bootloaderareasize 256k "$dev1"
check pv_field "$dev1" mda_size 1020.00k --units k
check pv_field "$dev1" ba_start 1024.00k --units k
check pv_field "$dev1" ba_size 1024.00k --units k
check pv_field "$dev1" pe_start 2048.00k --units k
pvremove "$dev1"
pvcreate --dataalignment 128k --bootloaderareasize 256k "$dev1"
check pv_field "$dev1" mda_size 1020.00k --units k
check pv_field "$dev1" ba_start 1024.00k --units k
check pv_field "$dev1" ba_size 256.00k --units k
check pv_field "$dev1" pe_start 1280.00k --units k
pvremove "$dev1"
pvcreate --dataalignment 128k --metadatasize 256k "$dev1"
check pv_field "$dev1" mda_size 380.00k --units k
check pv_field "$dev1" ba_start 0k --units k
check pv_field "$dev1" ba_size 0k --units k
check pv_field "$dev1" pe_start 384.00k --units k
pvremove "$dev1"
pvcreate --dataalignment 128k --metadatasize 256k --bootloaderareasize 256k "$dev1"
check pv_field "$dev1" mda_size 380.00k --units k
check pv_field "$dev1" ba_start 384.00k --units k
check pv_field "$dev1" ba_size 256.00k --units k
check pv_field "$dev1" pe_start 640.00k --units k
pvremove "$dev1"