master - lvconvert: fixe conversion message
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=eb6302c8cb6bfd1d983...
Commit: eb6302c8cb6bfd1d9831e5ff3d76ecbb49613178
Parent: 653bca6811d6e0928afb9de01d7baa7baaf23010
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Thu Apr 6 19:28:32 2017 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Thu Apr 6 19:28:32 2017 +0200
lvconvert: fixe conversion message
When selecting a convenience RAID type only display
the selected type when it changed. Display proper
current raid type when prompting.
---
lib/metadata/raid_manip.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index f522fe2..922eea7 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -5734,10 +5734,11 @@ static int _set_convenient_raid1456_segtype_to(const struct lv_segment *seg_from
replaced:
if (!(*segtype = get_segtype_from_flag(cmd, seg_flag)))
return_0;
- log_warn("Replaced LV type %s with possible type %s.",
- segtype_sav->name, (*segtype)->name);
+ if (segtype_sav != *segtype)
+ log_warn("Replaced LV type %s with possible type %s.",
+ segtype_sav->name, (*segtype)->name);
if (!yes && yes_no_prompt("Do you want to convert %s LV %s to %s? [y/n]: ",
- segtype_sav->name, display_lvname(seg_from->lv),
+ lvseg_name(seg_from), display_lvname(seg_from->lv),
(*segtype)->name) == 'n') {
log_error("Logical volume %s NOT converted.", display_lvname(seg_from->lv));
return 0;
7 years
master - lvconvert: raid1 -> linear prompt
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=653bca6811d6e0928af...
Commit: 653bca6811d6e0928afb9de01d7baa7baaf23010
Parent: 3b1a96b9b3650f8776e9d09573bc7754f283e234
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Thu Apr 6 19:24:11 2017 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Thu Apr 6 19:24:11 2017 +0200
lvconvert: raid1 -> linear prompt
Avoid 2 prompts when downconverting raid1 to linear
(related commit 0f65d7ec3a7325165af1a9f722cb760fd363e932).
---
lib/metadata/raid_manip.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index f360254..f522fe2 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -3000,9 +3000,10 @@ int lv_raid_change_image_count(struct logical_volume *lv, int yes, uint32_t new_
{
struct lv_segment *seg = first_seg(lv);
const char *level = seg->area_count == 1 ? "raid1 with " : "";
- const char *resil = new_count == 1 ? " loosing all" : (new_count < seg->area_count ? "s reducing" : "s enhancing");
+ const char *resil = new_count < seg->area_count ? "reducing" : "enhancing";
- if (!yes && yes_no_prompt("Are you sure you want to convert %s LV %s to %s%u image%s resilience? [y/n]: ",
+ if (new_count != 1 && /* Already prompted for in _raid_remove_images() */
+ !yes && yes_no_prompt("Are you sure you want to convert %s LV %s to %s%u images %s resilience? [y/n]: ",
lvseg_name(first_seg(lv)), display_lvname(lv), level, new_count, resil) == 'n') {
log_error("Logical volume %s NOT converted.", display_lvname(lv));
return 0;
7 years
master - lvconvert: avoid error message on raid1 -> raid4 conversion
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=3b1a96b9b3650f8776e...
Commit: 3b1a96b9b3650f8776e9d09573bc7754f283e234
Parent: 0f65d7ec3a7325165af1a9f722cb760fd363e932
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Thu Apr 6 19:09:05 2017 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Thu Apr 6 19:09:05 2017 +0200
lvconvert: avoid error message on raid1 -> raid4 conversion
Avoid error message
"Logical Volume *_rimage_0 already exists in volume group,,,"
on takeover conversion from a 2-legged raid1 to raid4
(aiming to reshape it adding images).
Resolves: rhbz1439398
---
lib/metadata/raid_manip.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 8c58f3c..f360254 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -5099,7 +5099,6 @@ static int _takeover_upconvert_wrapper(TAKEOVER_FN_ARGS)
!_clear_meta_lvs(lv))
return_0;
-
extents_copied = seg->extents_copied;
seg_len = seg->len;
stripe_size = seg->stripe_size;
@@ -5166,7 +5165,8 @@ static int _takeover_upconvert_wrapper(TAKEOVER_FN_ARGS)
_pre_raid_add_legs, NULL))
return 0;
- if (segtype_is_raid4(new_segtype)) {
+ if (segtype_is_raid4(new_segtype) &&
+ seg->area_count != 2) {
/* We had to rename SubLVs because of collision free shifting, rename back... */
if (!_rename_area_lvs(lv, NULL))
return_0;
7 years
master - lvconvert: prompt on raid1 image changes
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0f65d7ec3a7325165af...
Commit: 0f65d7ec3a7325165af1a9f722cb760fd363e932
Parent: e350b83d508aca11969ad5429d1095fb2e066432
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Thu Apr 6 18:47:41 2017 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Thu Apr 6 18:47:41 2017 +0200
lvconvert: prompt on raid1 image changes
Don't change resilience of raid1 LVs without --yes.
Adjust respective tests.
---
lib/metadata/raid_manip.c | 7 +++++++
test/shell/lvchange-raid.sh | 6 +++---
test/shell/lvconvert-cache-raid.sh | 14 +++++++-------
test/shell/lvconvert-raid-allocation.sh | 10 +++++-----
test/shell/lvconvert-raid-takeover.sh | 4 ++--
test/shell/lvconvert-raid.sh | 16 ++++++++--------
test/shell/lvconvert-thin-raid.sh | 4 ++--
test/shell/lvcreate-large-raid.sh | 2 +-
8 files changed, 35 insertions(+), 28 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 05cbb74..8c58f3c 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -2999,7 +2999,14 @@ int lv_raid_change_image_count(struct logical_volume *lv, int yes, uint32_t new_
const uint32_t new_region_size, struct dm_list *allocate_pvs)
{
struct lv_segment *seg = first_seg(lv);
+ const char *level = seg->area_count == 1 ? "raid1 with " : "";
+ const char *resil = new_count == 1 ? " loosing all" : (new_count < seg->area_count ? "s reducing" : "s enhancing");
+ if (!yes && yes_no_prompt("Are you sure you want to convert %s LV %s to %s%u image%s resilience? [y/n]: ",
+ lvseg_name(first_seg(lv)), display_lvname(lv), level, new_count, resil) == 'n') {
+ log_error("Logical volume %s NOT converted.", display_lvname(lv));
+ return 0;
+ }
if (new_region_size) {
seg->region_size = new_region_size;
_check_and_adjust_region_size(lv);
diff --git a/test/shell/lvchange-raid.sh b/test/shell/lvchange-raid.sh
index 09ef3fa..34a40dc 100644
--- a/test/shell/lvchange-raid.sh
+++ b/test/shell/lvchange-raid.sh
@@ -128,7 +128,7 @@ run_writemostly_check() {
# Converting to linear should clear flags and writebehind
not lvconvert -m 0 $vg/$lv $d1
lvconvert -y -m 0 $vg/$lv $d1
- lvconvert --type raid1 -m 1 $vg/$lv $d1
+ lvconvert -y --type raid1 -m 1 $vg/$lv $d1
check lv_field $vg/$lv raid_write_behind ""
check lv_attr_bit health $vg/${lv}_rimage_0 "-"
check lv_attr_bit health $vg/${lv}_rimage_1 "-"
@@ -274,7 +274,7 @@ run_checks() {
printf "#\n#\n# run_checks: RAID as thinpool data\n#\n#\n"
# Hey, specifying devices for thin allocation doesn't work
-# lvconvert --thinpool $1/$2 "$dev6"
+# lvconvert -y --thinpool $1/$2 "$dev6"
lvcreate -aey -L 2M -n ${2}_meta $1 "$dev6"
lvconvert --thinpool $1/$2 --poolmetadata ${2}_meta
lvcreate -T $1/$2 -V 1 -n thinlv
@@ -289,7 +289,7 @@ run_checks() {
lvrename $1/$2 ${2}_meta
lvcreate -aey -L 2M -n $2 $1 "$dev6"
- lvconvert --thinpool $1/$2 --poolmetadata ${2}_meta
+ lvconvert -y --thinpool $1/$2 --poolmetadata ${2}_meta
lvcreate -T $1/$2 -V 1 -n thinlv
THIN_POSTFIX="_tmeta"
diff --git a/test/shell/lvconvert-cache-raid.sh b/test/shell/lvconvert-cache-raid.sh
index 3ad91c4..e2fbf94 100644
--- a/test/shell/lvconvert-cache-raid.sh
+++ b/test/shell/lvconvert-cache-raid.sh
@@ -66,8 +66,8 @@ aux wait_for_sync $vg cpool_cmeta
lvchange --syncaction repair $vg/cpool_cdata
aux wait_for_sync $vg cpool_cdata
-lvconvert --repair -y $vg/cpool_cmeta
-lvconvert --repair -y $vg/cpool_cdata
+lvconvert -y --repair $vg/cpool_cmeta
+lvconvert -y --repair $vg/cpool_cdata
# do not allow reserved names for *new* LVs
not lvconvert --splitmirrors 1 --name split_cmeta $vg/cpool_cmeta "$dev1"
@@ -87,18 +87,18 @@ lvremove -f $vg
lvcreate --type cache-pool $vg/cpool -l 10
lvcreate -n corigin -H $vg/cpool -l 20
-lvconvert -m+1 --type raid1 $vg/cpool_cmeta
+lvconvert -y -m +1 --type raid1 $vg/cpool_cmeta
check lv_field $vg/cpool_cmeta layout "raid,raid1"
check lv_field $vg/cpool_cmeta role "private,cache,pool,metadata"
-lvconvert -m+1 --type raid1 $vg/cpool_cdata
+lvconvert -y -m +1 --type raid1 $vg/cpool_cdata
check lv_field $vg/cpool_cdata layout "raid,raid1"
check lv_field $vg/cpool_cdata role "private,cache,pool,data"
-not lvconvert -m-1 $vg/cpool_cmeta
-lvconvert -y -m-1 $vg/cpool_cmeta
+not lvconvert -m -1 $vg/cpool_cmeta
+lvconvert -y -m -1 $vg/cpool_cmeta
check lv_field $vg/cpool_cmeta layout "linear"
-lvconvert -y -m-1 $vg/cpool_cdata
+lvconvert -y -m -1 $vg/cpool_cdata
check lv_field $vg/cpool_cdata layout "linear"
lvremove -f $vg
diff --git a/test/shell/lvconvert-raid-allocation.sh b/test/shell/lvconvert-raid-allocation.sh
index 87e28fc..b23644c 100644
--- a/test/shell/lvconvert-raid-allocation.sh
+++ b/test/shell/lvconvert-raid-allocation.sh
@@ -24,11 +24,11 @@ vgcreate -s 256k $vg $(cat DEVICES)
lvcreate -aey -l 4 -n $lv1 $vg "$dev1:0-1" "$dev2:0-1"
not lvconvert --type raid1 -m 1 $vg/$lv1 "$dev1" "$dev2"
not lvconvert --type raid1 -m 1 $vg/$lv1 "$dev1" "$dev3:0-2"
-lvconvert --type raid1 -m 1 $vg/$lv1 "$dev3"
+lvconvert -y --type raid1 -m 1 $vg/$lv1 "$dev3"
not lvconvert -m 0 $vg/$lv1
lvconvert -y -m 0 $vg/$lv1
# RAID conversions are not honoring allocation policy!
-# lvconvert --type raid1 -m 1 --alloc anywhere $vg/$lv1 "$dev1" "$dev2"
+# lvconvert -y --type raid1 -m 1 --alloc anywhere $vg/$lv1 "$dev1" "$dev2"
lvremove -ff $vg
@@ -48,12 +48,12 @@ aux wait_for_sync $vg $lv1
# Should not be enough non-overlapping space.
not lvconvert -m +1 $vg/$lv1 \
"$dev5:0-1" "$dev1" "$dev2" "$dev3" "$dev4"
-lvconvert -m +1 $vg/$lv1 "$dev5"
+lvconvert -y -m +1 $vg/$lv1 "$dev5"
not lvconvert -m 0 $vg/$lv1
lvconvert -y -m 0 $vg/$lv1
# Should work due to '--alloc anywhere'
# RAID conversion not honoring allocation policy!
-#lvconvert -m +1 --alloc anywhere $vg/$lv1 \
+#lvconvert -y -m +1 --alloc anywhere $vg/$lv1 \
# "$dev5:0-1" "$dev1" "$dev2" "$dev3" "$dev4"
lvremove -ff $vg
@@ -68,7 +68,7 @@ lvcreate --type raid1 -m 1 -l 3 -n $lv1 $vg \
"$dev1:0-1" "$dev2:0-1" "$dev3:0-1" "$dev4:0-1"
aux wait_for_sync $vg $lv1
aux disable_dev "$dev1"
-lvconvert --repair -y $vg/$lv1 "$dev2" "$dev3" "$dev4"
+lvconvert -y --repair $vg/$lv1 "$dev2" "$dev3" "$dev4"
#FIXME: ensure non-overlapping images (they should not share PVs)
aux enable_dev "$dev1"
lvremove -ff $vg
diff --git a/test/shell/lvconvert-raid-takeover.sh b/test/shell/lvconvert-raid-takeover.sh
index e1b1d98..8e3ffb1 100644
--- a/test/shell/lvconvert-raid-takeover.sh
+++ b/test/shell/lvconvert-raid-takeover.sh
@@ -132,7 +132,7 @@ aux wait_for_sync $vg $lv1
fsck -fn "$DM_DEV_DIR/$vg/$lv1"
# Convert 3-way to 4-way mirror
-lvconvert -m 3 $vg/$lv1
+lvconvert -y -m 3 $vg/$lv1
detect_error_leak_
check lv_field $vg/$lv1 segtype "mirror"
check lv_field $vg/$lv1 stripes 4
@@ -149,7 +149,7 @@ check lv_field $vg/$lv1 regionsize "64.00k"
fsck -fn "$DM_DEV_DIR/$vg/$lv1"
## Convert 4-way raid1 to 5-way
-lvconvert -m 4 -R 128K $vg/$lv1
+lvconvert -y -m 4 -R 128K $vg/$lv1
detect_error_leak_
check lv_field $vg/$lv1 segtype "raid1"
check lv_field $vg/$lv1 stripes 5
diff --git a/test/shell/lvconvert-raid.sh b/test/shell/lvconvert-raid.sh
index a9b36e2..e173d66 100644
--- a/test/shell/lvconvert-raid.sh
+++ b/test/shell/lvconvert-raid.sh
@@ -75,14 +75,14 @@ for i in 1 2 3; do
mirrors=$((j - 1))
if [ $i -eq 1 ]
then
- [ $mirrors -eq 0 ] && lvconvert -m $mirrors $vg/$lv1
+ [ $mirrors -eq 0 ] && lvconvert -y -m $mirrors $vg/$lv1
else
if [ $mirrors -eq 0 ]
then
not lvconvert -m $mirrors $vg/$lv1
lvconvert -y -m $mirrors $vg/$lv1
else
- lvconvert -m $mirrors $vg/$lv1
+ lvconvert -y -m $mirrors $vg/$lv1
fi
fi
@@ -105,13 +105,13 @@ lvcreate --type raid1 -m 1 -l 2 -n $lv1 $vg --nosync
not lvconvert -m +1 $vg/$lv1
lvchange --resync -y $vg/$lv1
aux wait_for_sync $vg $lv1
-lvconvert -m +1 $vg/$lv1
+lvconvert -y -m +1 $vg/$lv1
lvremove -ff $vg
# 3-way to 2-way convert while specifying devices
lvcreate --type raid1 -m 2 -l 2 -n $lv1 $vg "$dev1" "$dev2" "$dev3"
aux wait_for_sync $vg $lv1
-lvconvert -m1 $vg/$lv1 "$dev2"
+lvconvert -y -m 1 $vg/$lv1 "$dev2"
lvremove -ff $vg
#
@@ -188,7 +188,7 @@ lvremove -ff $vg
# Linear to RAID1 conversion ("raid1" default segtype)
###########################################
lvcreate -aey -l 2 -n $lv1 $vg
-lvconvert -m 1 $vg/$lv1 \
+lvconvert -y -m 1 $vg/$lv1 \
--config 'global { mirror_segtype_default = "raid1" }'
lvs --noheadings -o attr $vg/$lv1 | grep '^[[:space:]]*r'
lvremove -ff $vg
@@ -197,7 +197,7 @@ lvremove -ff $vg
# Linear to RAID1 conversion (override "mirror" default segtype)
###########################################
lvcreate -aey -l 2 -n $lv1 $vg
-lvconvert --type raid1 -m 1 $vg/$lv1 \
+lvconvert --yes --type raid1 -m 1 $vg/$lv1 \
--config 'global { mirror_segtype_default = "mirror" }'
lvs --noheadings -o attr $vg/$lv1 | grep '^[[:space:]]*r'
lvremove -ff $vg
@@ -207,7 +207,7 @@ lvremove -ff $vg
###########################################
if [ -e LOCAL_CLVMD ]; then
lvcreate -l 2 -n $lv1 $vg
- not lvconvert --type raid1 -m 1 $vg/$lv1 \
+ not lvconvert -y --type raid1 -m 1 $vg/$lv1 \
--config 'global { mirror_segtype_default = "mirror" }'
lvremove -ff $vg
fi
@@ -218,7 +218,7 @@ fi
for i in 1 2 3 ; do
lvcreate -aey --type mirror -m $i -l 2 -n $lv1 $vg
aux wait_for_sync $vg $lv1
- lvconvert --type raid1 $vg/$lv1
+ lvconvert -y --type raid1 $vg/$lv1
lvremove -ff $vg
done
diff --git a/test/shell/lvconvert-thin-raid.sh b/test/shell/lvconvert-thin-raid.sh
index 7890350..807b1dc 100644
--- a/test/shell/lvconvert-thin-raid.sh
+++ b/test/shell/lvconvert-thin-raid.sh
@@ -54,7 +54,7 @@ lvremove -ff $vg/data2 $vg/data3 $vg/meta1 $vg/meta2
lvconvert --merge $vg/${lv1}_tdata_rimage_1
lvconvert --merge $vg/${lv1}_tmeta_rimage_1
-lvconvert -m+1 $vg/${lv1}_tdata "$dev2"
-lvconvert -m+1 $vg/${lv1}_tmeta "$dev1"
+lvconvert -y -m +1 $vg/${lv1}_tdata "$dev2"
+lvconvert -y -m +1 $vg/${lv1}_tmeta "$dev1"
vgremove -ff $vg
diff --git a/test/shell/lvcreate-large-raid.sh b/test/shell/lvcreate-large-raid.sh
index 4e68b2c..ca3f715 100644
--- a/test/shell/lvcreate-large-raid.sh
+++ b/test/shell/lvcreate-large-raid.sh
@@ -99,7 +99,7 @@ lvremove -ff $vg1
# Convert large 200 TiB linear to RAID1 (belong in different test script?)
#
lvcreate -aey -L 200T -n $lv1 $vg1
-lvconvert --type raid1 -m 1 $vg1/$lv1
+lvconvert -y --type raid1 -m 1 $vg1/$lv1
check lv_field $vg1/$lv1 size "200.00t"
check raid_leg_status $vg1 $lv1 "aa"
lvremove -ff $vg1
7 years
master - raid: reload on removing images
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e350b83d508aca11969...
Commit: e350b83d508aca11969ad5429d1095fb2e066432
Parent: a8d5ada452570e1c9b0c6e0ae0a311870056896a
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Thu Apr 6 00:47:34 2017 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Thu Apr 6 00:47:34 2017 +0200
raid: reload on removing images
Requesting _raid_remove_images() to commit the
metadata missed to reload the origin causing a
kernel takeover error converting a 2-legged raid1
(with previously removed images) to raid5.
---
lib/metadata/raid_manip.c | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 07bb131..05cbb74 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -1592,7 +1592,6 @@ static int _lv_free_reshape_space_with_status(struct logical_volume *lv, enum al
*/
if (!_lv_alloc_reshape_space(lv, alloc_end, &where, NULL))
return_0;
-
seg->extents_copied = first_seg(lv)->area_len;
if (!lv_reduce(lv, total_reshape_len))
return_0;
@@ -2918,6 +2917,8 @@ static int _raid_remove_images(struct logical_volume *lv, int yes,
return 0;
}
+ first_seg(lv)->area_count = new_count;
+
/* Convert to linear? */
if (new_count == 1) {
if (!yes && yes_no_prompt("Are you sure you want to convert %s LV %s to type %s loosing all resilience? [y/n]: ",
@@ -2944,13 +2945,11 @@ static int _raid_remove_images(struct logical_volume *lv, int yes,
/*
* Eliminate the extracted LVs
*/
- if (!dm_list_empty(removal_lvs)) {
- if (!_deactivate_and_remove_lvs(lv->vg, removal_lvs))
- return_0;
+ if (!_deactivate_and_remove_lvs(lv->vg, removal_lvs))
+ return_0;
- if (!vg_write(lv->vg) || !vg_commit(lv->vg))
- return_0;
- }
+ if (!lv_update_and_reload_origin(lv))
+ return_0;
backup(lv->vg);
7 years
master - man: lvmraid.7 raid6_n_6 fix
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a8d5ada452570e1c9b0...
Commit: a8d5ada452570e1c9b0c6e0ae0a311870056896a
Parent: d23cad16c9210f6b01994a5e4c0637584dba80f9
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Thu Apr 6 00:35:12 2017 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Thu Apr 6 00:35:12 2017 +0200
man: lvmraid.7 raid6_n_6 fix
---
man/lvmraid.7_main | 14 ++------------
1 files changed, 2 insertions(+), 12 deletions(-)
diff --git a/man/lvmraid.7_main b/man/lvmraid.7_main
index 7a3235b..d000687 100644
--- a/man/lvmraid.7_main
+++ b/man/lvmraid.7_main
@@ -1554,7 +1554,8 @@ raid6_n_6
RAID6 last parity devices
.br
\[bu]
-Dedicated last parity devices used for striped/raid0 conversions
+Fixed dedicated last devices (P-Syndrome N-1 and Q-Syndrome N)
+with striped data used for striped/raid0 conversions
\[bu]
Used for RAID Takeover
@@ -1566,17 +1567,6 @@ RAID6 last parity device
\[bu]
Dedicated last parity device used for conversions from/to raid5_{ls,rs,la,ra}
-raid6_n_6
-.br
-\[bu]
-RAID6 N continue
-.br
-\[bu]
-Fixed P-Syndrome N-1 and Q-Syndrome N with striped data
-.br
-\[bu]
-Used for RAID Takeover
-
raid6_ls_6
.br
\[bu]
7 years
master - raid: tidying
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d23cad16c9210f6b019...
Commit: d23cad16c9210f6b01994a5e4c0637584dba80f9
Parent: 1ef1bdab27b2e2d3fb2491b42e3f7afa3b93140e
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Thu Apr 6 00:06:52 2017 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Thu Apr 6 00:06:52 2017 +0200
raid: tidying
---
lib/metadata/raid_manip.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index c7d1d76..07bb131 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -1933,7 +1933,7 @@ static int _raid_reshape_remove_images(struct logical_volume *lv,
* -> remove the freed up images and reduce LV size
*
*/
- if (!_get_available_removed_sublvs(lv, &available_slvs, &removed_slvs))
+ if (!_get_available_removed_sublvs(lv, &available_slvs, &removed_slvs))
return_0;
if (devs_in_sync != new_image_count) {
7 years
master - lvconvert: allow --type with --regionsize
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=1ef1bdab27b2e2d3fb2...
Commit: 1ef1bdab27b2e2d3fb2491b42e3f7afa3b93140e
Parent: 7ccb4825c7c5f40e93afea065100105f3d5f3551
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Thu Apr 6 00:01:29 2017 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Thu Apr 6 00:03:16 2017 +0200
lvconvert: allow --type with --regionsize
Allow the combination of both arguments keeping
the raid level but changing the regionssize
(e.g. "lvconvert --type raid1 --regionsize 1M RaidLV"
on an existing raid1 LV).
Resolves: rhbz1438396
---
lib/metadata/raid_manip.c | 26 ++++++++++++++++++++++++--
1 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 63a2a6c..c7d1d76 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -5355,7 +5355,7 @@ static int _takeover_from_raid1_to_raid0_meta(TAKEOVER_FN_ARGS)
static int _takeover_from_raid1_to_raid1(TAKEOVER_FN_ARGS)
{
- return _takeover_unsupported_yet(lv, new_stripes, new_segtype);
+ return _takeover_unsupported(lv, new_segtype, 0, 0, 0, 0, new_stripes, 0, 0, NULL);
}
static int _takeover_from_raid1_to_raid10(TAKEOVER_FN_ARGS)
@@ -5975,7 +5975,29 @@ int lv_raid_convert(struct logical_volume *lv,
/* Exit without doing activation checks if the combination isn't possible */
if (_takeover_not_possible(takeover_fn))
return takeover_fn(lv, new_segtype, yes, force, new_image_count, 0, new_stripes, stripe_size,
- region_size, allocate_pvs);
+ region_size, allocate_pvs);
+
+ /*
+ * User requested "--type raid*" without neither
+ * requesting a reshape nor a takeover.
+ *
+ * I.e. the raid level is the same but no layout,
+ * stripesize or number of stripes change is required.
+ *
+ * Check if a regionsize change is required.
+ */
+ if (seg->segtype == new_segtype && new_region_size) {
+ if (seg->region_size != new_region_size) {
+ log_verbose("Converting %s LV %s to regionsize %s.",
+ lvseg_name(first_seg(lv)), display_lvname(lv),
+ display_size(lv->vg->cmd, new_region_size));
+ return _region_size_change_requested(lv, yes, new_region_size);
+ } else {
+ log_error("Can't convert %s LV %s without a region size change.",
+ lvseg_name(seg), display_lvname(lv));
+ return 0;
+ }
+ }
log_verbose("Converting %s from %s to %s.",
display_lvname(lv), lvseg_name(first_seg(lv)),
7 years
master - lvchange/lvconvert: fix missing lvmlockd LV locks
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7ccb4825c7c5f40e93a...
Commit: 7ccb4825c7c5f40e93afea065100105f3d5f3551
Parent: c9bc1c1c8ccd624762b59a46689467573bc2933e
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Apr 5 15:05:32 2017 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Apr 5 16:46:38 2017 -0500
lvchange/lvconvert: fix missing lvmlockd LV locks
lvchange/lvconvert operations that do not require the LV
to already be active need to acquire a transient LV lock
before changing/converting the LV to ensure the LV is not
active on another host. If the LV is already active,
a persistent LV lock already exists on the host and the
transient LV lock request is a no-op.
Some lvmlockd locks in lvchange were lost in the cmd def
changes. The lvmlockd locks in lvconvert seem to have
been missed from the start.
---
tools/lvchange.c | 29 +++++++++++++++++++----------
tools/lvconvert.c | 26 ++++++++++++++++++++++++++
2 files changed, 45 insertions(+), 10 deletions(-)
diff --git a/tools/lvchange.c b/tools/lvchange.c
index a35891e..660570a 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -1056,16 +1056,9 @@ static int _lvchange_properties_single(struct cmd_context *cmd,
int i, opt_enum;
uint32_t mr = 0;
- /*
- * If a persistent lv lock already exists from activation
- * (with the needed mode or higher), this will be a no-op.
- * Otherwise, the lv lock will be taken as non-persistent
- * and released when this command exits.
- */
- if (!lockd_lv(cmd, lv, "ex", 0)) {
- stack;
- return ECMD_FAILED;
- }
+ /* If LV is inactive here, ensure it's not active elsewhere. */
+ if (!lockd_lv(cmd, lv, "ex", 0))
+ return_ECMD_FAILED;
/* First group of options which allow for one metadata commit/update for the whole group */
for (i = 0; i < cmd->command->ro_count; i++) {
@@ -1451,6 +1444,10 @@ static int _lvchange_resync_single(struct cmd_context *cmd,
struct logical_volume *lv,
struct processing_handle *handle)
{
+ /* If LV is inactive here, ensure it's not active elsewhere. */
+ if (!lockd_lv(cmd, lv, "ex", 0))
+ return_ECMD_FAILED;
+
if (!_lvchange_resync(cmd, lv))
return_ECMD_FAILED;
@@ -1502,6 +1499,10 @@ static int _lvchange_syncaction_single(struct cmd_context *cmd,
struct logical_volume *lv,
struct processing_handle *handle)
{
+ /* If LV is inactive here, ensure it's not active elsewhere. */
+ if (!lockd_lv(cmd, lv, "ex", 0))
+ return_ECMD_FAILED;
+
if (!lv_raid_message(lv, arg_str_value(cmd, syncaction_ARG, NULL)))
return_ECMD_FAILED;
@@ -1532,6 +1533,10 @@ static int _lvchange_rebuild_single(struct cmd_context *cmd,
struct logical_volume *lv,
struct processing_handle *handle)
{
+ /* If LV is inactive here, ensure it's not active elsewhere. */
+ if (!lockd_lv(cmd, lv, "ex", 0))
+ return_ECMD_FAILED;
+
if (!_lvchange_rebuild(lv))
return_ECMD_FAILED;
@@ -1601,6 +1606,10 @@ static int _lvchange_persistent_single(struct cmd_context *cmd,
{
uint32_t mr = 0;
+ /* If LV is inactive here, ensure it's not active elsewhere. */
+ if (!lockd_lv(cmd, lv, "ex", 0))
+ return_ECMD_FAILED;
+
if (!_lvchange_persistent(cmd, lv, &mr))
return_ECMD_FAILED;
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index a37dc25..c28a75f 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -1685,6 +1685,10 @@ static int _lvconvert_raid_types(struct cmd_context *cmd, struct logical_volume
struct lv_segment *seg = first_seg(lv);
int ret = 0;
+ /* If LV is inactive here, ensure it's not active elsewhere. */
+ if (!lockd_lv(cmd, lv, "ex", 0))
+ return_ECMD_FAILED;
+
/* Set up segtype either from type_str or else to match the existing one. */
if (!*lp->type_str)
lp->segtype = seg->segtype;
@@ -2734,6 +2738,10 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
return 0;
}
+ /* If LV is inactive here, ensure it's not active elsewhere. */
+ if (!lockd_lv(cmd, lv, "ex", 0))
+ return 0;
+
/*
* If an existing LV is to be used as the metadata LV,
* verify that it's in a usable state. These checks are
@@ -2789,6 +2797,10 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
display_lvname(metadata_lv));
return 0;
}
+
+ /* If LV is inactive here, ensure it's not active elsewhere. */
+ if (!lockd_lv(cmd, metadata_lv, "ex", 0))
+ return 0;
}
if (!get_pool_params(cmd, pool_segtype,
@@ -3135,6 +3147,10 @@ static int _lvconvert_to_cache_vol(struct cmd_context *cmd,
struct dm_config_tree *policy_settings = NULL;
int r = 0;
+ /* If LV is inactive here, ensure it's not active elsewhere. */
+ if (!lockd_lv(cmd, lv, "ex", 0))
+ return_0;
+
if (!validate_lv_cache_create_pool(cachepool_lv))
return_0;
@@ -3958,6 +3974,12 @@ static int _lvconvert_swap_pool_metadata_single(struct cmd_context *cmd,
struct logical_volume *metadata_lv;
const char *metadata_name;
+ if (is_lockd_type(lv->vg->lock_type)) {
+ /* FIXME: need to swap locks betwen LVs? */
+ log_error("Unable to swap pool metadata in VG with lock_type %s", lv->vg->lock_type);
+ goto out;
+ }
+
if (!(metadata_name = arg_str_value(cmd, poolmetadata_ARG, NULL)))
goto_out;
@@ -4133,6 +4155,10 @@ static int _lvconvert_split_cachepool_single(struct cmd_context *cmd,
return ECMD_FAILED;
}
+ /* If LV is inactive here, ensure it's not active elsewhere. */
+ if (!lockd_lv(cmd, cache_lv, "ex", 0))
+ return_0;
+
switch (cmd->command->command_enum) {
case lvconvert_split_and_keep_cachepool_CMD:
ret = _lvconvert_split_and_keep_cachepool(cmd, cache_lv, cachepool_lv);
7 years
master - lvchange: tidy switch code in _lvchange_properties_single()
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c9bc1c1c8ccd624762b...
Commit: c9bc1c1c8ccd624762b59a46689467573bc2933e
Parent: 6fdc391baec1129d0c70913f116c04f928d083fa
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Wed Apr 5 17:29:31 2017 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Wed Apr 5 17:29:31 2017 +0200
lvchange: tidy switch code in _lvchange_properties_single()
---
tools/lvchange.c | 91 +++++++++++++++++++++++++++++++++++-------------------
1 files changed, 59 insertions(+), 32 deletions(-)
diff --git a/tools/lvchange.c b/tools/lvchange.c
index 1778b52..a35891e 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -974,6 +974,58 @@ static int _commit_reload(struct logical_volume *lv, uint32_t mr)
return 1;
}
+/* Helper: check @opt_num is listed in @opts array */
+static int _is_option_listed(int opt_enum, int *options)
+{
+ int i;
+
+ for (i = 0; options[i] != -1; i++)
+ if (opt_enum == options[i])
+ return 1;
+ return 0;
+}
+
+/* Check @opt_enum is an option allowing group commit/reload */
+static int _option_allows_group_commit(int opt_enum)
+{
+ int options[] = {
+ permission_ARG,
+ alloc_ARG,
+ contiguous_ARG,
+ errorwhenfull_ARG,
+ readahead_ARG,
+ persistent_ARG,
+ addtag_ARG,
+ deltag_ARG,
+ writemostly_ARG,
+ writebehind_ARG,
+ minrecoveryrate_ARG,
+ maxrecoveryrate_ARG,
+ profile_ARG,
+ metadataprofile_ARG,
+ detachprofile_ARG,
+ setactivationskip_ARG,
+ -1
+ };
+
+ return _is_option_listed(opt_enum, options);
+}
+
+/* Check @opt_enum requires direct commit/reload */
+static int _option_requires_direct_commit(int opt_enum)
+{
+ int options[] = {
+ discards_ARG,
+ zero_ARG,
+ cachemode_ARG,
+ cachepolicy_ARG,
+ cachesettings_ARG,
+ -1
+ };
+
+ return _is_option_listed(opt_enum, options);
+}
+
/*
* For each lvchange command definintion:
*
@@ -1022,20 +1074,13 @@ static int _lvchange_properties_single(struct cmd_context *cmd,
if (!arg_is_set(cmd, opt_enum))
continue;
- switch (opt_enum) {
/*
- * Skip options requiring per option commit/reload
+ * Skip options requiring direct commit/reload
* to process them in the second step.
*/
- case discards_ARG:
- case zero_ARG:
- case cachemode_ARG:
- case cachepolicy_ARG:
- case cachesettings_ARG:
+ if (_option_requires_direct_commit(opt_enum)) {
second_group++;
continue;
- default:
- break;
}
/* Archive will only happen once per run. */
@@ -1141,28 +1186,9 @@ static int _lvchange_properties_single(struct cmd_context *cmd,
if (!arg_is_set(cmd, opt_enum))
continue;
- switch (opt_enum) {
- /* Skip any of the already processed options */
- case permission_ARG:
- case alloc_ARG:
- case contiguous_ARG:
- case errorwhenfull_ARG:
- case readahead_ARG:
- case persistent_ARG:
- case addtag_ARG:
- case deltag_ARG:
- case writemostly_ARG:
- case writebehind_ARG:
- case minrecoveryrate_ARG:
- case maxrecoveryrate_ARG:
- case profile_ARG:
- case metadataprofile_ARG:
- case detachprofile_ARG:
- case setactivationskip_ARG:
+ /* Skip any of the already processed options which allowed for group commit/reload */
+ if (_option_allows_group_commit(opt_enum))
continue;
- default:
- break;
- }
/* Archive will only happen once per run */
if (!archive(lv->vg))
@@ -1170,8 +1196,8 @@ static int _lvchange_properties_single(struct cmd_context *cmd,
mr = 0;
+ /* Run commit and reload after processing each of the following options */
switch (opt_enum) {
- /* Process the following options which need per option metadata commit and reload */
case discards_ARG:
case zero_ARG:
docmds++;
@@ -1186,7 +1212,8 @@ static int _lvchange_properties_single(struct cmd_context *cmd,
break;
default:
- break;
+ log_error(INTERNAL_ERROR "Failed to check for option %s",
+ arg_long_option_name(i));
}
/* Display any logical volume change unless already displayed in step 1. */
7 years