1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

validation: capture store of LV without segment

This commit is contained in:
Zdenek Kabelac 2017-10-30 14:34:30 +01:00
parent e9206fb93d
commit 0424410773
3 changed files with 18 additions and 3 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.176 - Version 2.02.176 -
=================================== ===================================
Do not allow storing VG metadata with LV without any segment.
Fix printed message when thin snapshot was already merged. Fix printed message when thin snapshot was already merged.
Remove created spare LV when creation of thin-pool failed. Remove created spare LV when creation of thin-pool failed.
Avoid reading ignored metadata when mda gets used again. Avoid reading ignored metadata when mda gets used again.

View File

@ -628,6 +628,11 @@ int check_lv_segments(struct logical_volume *lv, int complete_vg)
inc_error_count; inc_error_count;
} }
if (!le) {
log_error("LV %s: has no segment.", lv->name);
inc_error_count;
}
dm_list_iterate_items(sl, &lv->segs_using_this_lv) { dm_list_iterate_items(sl, &lv->segs_using_this_lv) {
seg = sl->seg; seg = sl->seg;
seg_found = 0; seg_found = 0;

View File

@ -189,8 +189,8 @@ done
echo Test special situations, vgsplit, vgmerge, etc echo Test special situations, vgsplit, vgmerge, etc
for mdacp in 1 2; do for mdacp in 1 2; do
pvcreate --metadatacopies $mdacp "$dev1" "$dev2" "$dev3" "$dev4" "$dev5" pvcreate --metadatacopies $mdacp "$dev1" "$dev2" "$dev3" "$dev4" "$dev5"
vgcreate --vgmetadatacopies 2 $vg1 "$dev1" "$dev2" "$dev3" vgcreate -cy --vgmetadatacopies 2 $vg1 "$dev1" "$dev2" "$dev3"
vgcreate --vgmetadatacopies $(( mdacp * 1 )) $vg2 "$dev4" "$dev5" vgcreate -cy --vgmetadatacopies $(( mdacp * 1 )) $vg2 "$dev4" "$dev5"
echo vgsplit/vgmerge preserves value of metadata copies echo vgsplit/vgmerge preserves value of metadata copies
check vg_field $vg1 vg_mda_copies 2 check vg_field $vg1 vg_mda_copies 2
check vg_field $vg2 vg_mda_copies $(( mdacp * 1 )) check vg_field $vg2 vg_mda_copies $(( mdacp * 1 ))
@ -200,7 +200,16 @@ for mdacp in 1 2; do
check vg_field $vg1 vg_mda_copies 2 check vg_field $vg1 vg_mda_copies 2
check vg_field $vg1 vg_mda_count $(( mdacp * 5 )) check vg_field $vg1 vg_mda_count $(( mdacp * 5 ))
echo vgsplit into new vg sets proper value of vgmetadatacopies echo vgsplit into new vg sets proper value of vgmetadatacopies
vgsplit --vgmetadatacopies $(( mdacp * 2 )) $vg1 $vg2 "$dev1" "$dev2" # echo y | pvchange -y --metadataignore n "$dev3" || true
# echo y | pvchange -y --metadataignore y "$dev4" || true
# echo y | pvchange -y --metadataignore n "$dev5" || true
# echo y | pvchange -y --metadataignore y "$dev1" || true
# echo y | pvchange -y --metadataignore y "$dev2" || true
pvs -o+pv_mda_size,pv_mda_count,pv_mda_used_count,pv_in_use
pvdisplay
#LVM_GDB=1
vgsplit --vgmetadatacopies $(( mdacp * 2 )) $vg1 $vg2 "$dev1" "$dev2"
check vg_field $vg2 vg_mda_copies $(( mdacp * 2 )) check vg_field $vg2 vg_mda_copies $(( mdacp * 2 ))
echo vgchange fails if given both vgmetadatacopies and metadatacopies echo vgchange fails if given both vgmetadatacopies and metadatacopies
not vgchange --vgmetadatacopies 5 --metadatacopies 7 $vg2 not vgchange --vgmetadatacopies 5 --metadatacopies 7 $vg2