From 6920681cabc3051fcd8c88e7eb447c3027948815 Mon Sep 17 00:00:00 2001 From: Dave Wysochanski Date: Thu, 10 Apr 2008 21:38:52 +0000 Subject: [PATCH] Update vgsplit test to verify loosening of active LV restriction. This and prior 2 commits resolve Red Hat bz 252041: Ability to vgsplit an active Volume Group where the split involves only inactive LVs --- WHATS_NEW | 3 ++ test/t-vgsplit-operation.sh | 59 +++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/WHATS_NEW b/WHATS_NEW index 160818b16..feaaf336b 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,8 @@ Version 2.02.35 - ================================= + Update vgsplit tests to verify loosening of active LV restriction. + Update vgsplit to only restrict split with active LVs involved in split. + Add lv_is_active() to determine whether an lv is active. Version 2.02.34 - 10th April 2008 ================================= diff --git a/test/t-vgsplit-operation.sh b/test/t-vgsplit-operation.sh index 2419b3da9..9d52095bf 100755 --- a/test/t-vgsplit-operation.sh +++ b/test/t-vgsplit-operation.sh @@ -276,6 +276,65 @@ test_expect_success \ status=$?; echo status=$status; test $status = 5 && vgremove -ff $vg1' +# +# Verify vgsplit rejects active LVs only when active LVs involved in split +# +test_expect_success \ + "vgsplit fails, active mirror involved in split" \ + 'vgcreate $vg1 $d1 $d2 $d3 $d4 && + lvcreate -l 16 -n $lv1 -m1 $vg1 $d1 $d2 $d3 && + lvcreate -l 16 -n $lv2 $vg1 $d4 && + lvchange -an $vg1/$lv2 && + vg_validate_pvlv_counts_ $vg1 4 2 0 && + vgsplit -n $lv1 $vg1 $vg2; + status=$?; echo status=$status; test $status = 5 && + vg_validate_pvlv_counts_ $vg1 4 2 0 && + vgremove -ff $vg1' + +test_expect_success \ + "vgsplit succeeds, active mirror not involved in split" \ + 'vgcreate $vg1 $d1 $d2 $d3 $d4 && + lvcreate -l 16 -n $lv1 -m1 $vg1 $d1 $d2 $d3 && + lvcreate -l 16 -n $lv2 $vg1 $d4 && + lvchange -an $vg1/$lv2 && + vg_validate_pvlv_counts_ $vg1 4 2 0 && + vgsplit -n $lv2 $vg1 $vg2 && + vg_validate_pvlv_counts_ $vg1 3 1 0 && + vg_validate_pvlv_counts_ $vg2 1 1 0 && + vgremove -ff $vg1 && + vgremove -ff $vg2' + +test_expect_success \ + "vgsplit fails, active snapshot involved in split" \ + 'vgcreate $vg1 $d1 $d2 $d3 $d4 && + lvcreate -l 64 -i 2 -n $lv1 $vg1 $d1 $d2 && + lvcreate -l 4 -i 2 -s -n $lv2 $vg1/$lv1 && + lvcreate -l 64 -i 2 -n $lv3 $vg1 $d3 $d4 && + lvchange -an $vg1/$lv3 && + vg_validate_pvlv_counts_ $vg1 4 3 1 && + vgsplit -n $lv2 $vg1 $vg2; + status=$?; echo status=$status; test $status = 5 && + vg_validate_pvlv_counts_ $vg1 4 3 1 && + lvremove -f $vg1/$lv2 && + vgremove -ff $vg1' + +test_expect_success \ + "vgsplit succeeds, active snapshot not involved in split" \ + 'vgcreate $vg1 $d1 $d2 $d3 && + lvcreate -l 64 -i 2 -n $lv1 $vg1 $d1 $d2 && + lvcreate -l 4 -s -n $lv2 $vg1/$lv1 && + vgextend $vg1 $d4 && + lvcreate -l 64 -n $lv3 $vg1 $d4 && + lvchange -an $vg1/$lv3 && + vg_validate_pvlv_counts_ $vg1 4 3 1 && + vgsplit -n $lv3 $vg1 $vg2 && + vg_validate_pvlv_counts_ $vg1 3 2 1 && + vg_validate_pvlv_counts_ $vg2 1 1 0 && + vgchange -an $vg1 && + lvremove -f $vg1/$lv2 && + vgremove -ff $vg1 && + vgremove -ff $vg2' + test_done