master - test: raid1 down convert to linear
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=4b0ae266c2d20a68232...
Commit: 4b0ae266c2d20a682329c37bb0e8cd28b76b9c95
Parent: 413164765fc81b6b9e551114d92f382ad273429b
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Thu Mar 9 13:16:08 2017 +0100
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Thu Mar 9 13:16:08 2017 +0100
test: raid1 down convert to linear
Add/adjust more tests for commit 7fbe6ef16bfb.
---
test/shell/lvchange-raid.sh | 3 ++-
test/shell/lvconvert-raid-allocation.sh | 6 ++++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/test/shell/lvchange-raid.sh b/test/shell/lvchange-raid.sh
index f81cc53..09ef3fa 100644
--- a/test/shell/lvchange-raid.sh
+++ b/test/shell/lvchange-raid.sh
@@ -126,7 +126,8 @@ run_writemostly_check() {
check lv_field $vg/$lv raid_write_behind "512"
# Converting to linear should clear flags and writebehind
- lvconvert -m 0 $vg/$lv $d1
+ not lvconvert -m 0 $vg/$lv $d1
+ lvconvert -y -m 0 $vg/$lv $d1
lvconvert --type raid1 -m 1 $vg/$lv $d1
check lv_field $vg/$lv raid_write_behind ""
check lv_attr_bit health $vg/${lv}_rimage_0 "-"
diff --git a/test/shell/lvconvert-raid-allocation.sh b/test/shell/lvconvert-raid-allocation.sh
index c5927a7..87e28fc 100644
--- a/test/shell/lvconvert-raid-allocation.sh
+++ b/test/shell/lvconvert-raid-allocation.sh
@@ -25,7 +25,8 @@ 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 -m 0 $vg/$lv1
+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"
lvremove -ff $vg
@@ -48,7 +49,8 @@ aux wait_for_sync $vg $lv1
not lvconvert -m +1 $vg/$lv1 \
"$dev5:0-1" "$dev1" "$dev2" "$dev3" "$dev4"
lvconvert -m +1 $vg/$lv1 "$dev5"
-lvconvert -m 0 $vg/$lv1
+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 \
6 years, 2 months
master - lvconvert: remove superfluous compile time conditonal code
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=413164765fc81b6b9e5...
Commit: 413164765fc81b6b9e551114d92f382ad273429b
Parent: 3d1df10af381bd1ae87be2209b1a7ff0d1167793
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Thu Mar 9 12:16:11 2017 +0100
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Thu Mar 9 12:16:11 2017 +0100
lvconvert: remove superfluous compile time conditonal code
---
tools/lvconvert.c | 6 ------
1 files changed, 0 insertions(+), 6 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 4827d6e..9153633 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -1369,12 +1369,6 @@ static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *l
}
goto try_new_takeover_or_reshape;
}
-#if 0
- } else if ((!*lp->type_str || seg->segtype == lp->segtype) && !lp->stripe_size_supplied) {
- log_error("Conversion operation not yet supported.");
- return 0;
- }
-#endif
if ((seg_is_linear(seg) || seg_is_striped(seg) || seg_is_mirrored(seg) || lv_is_raid(lv)) &&
(lp->type_str && lp->type_str[0])) {
6 years, 2 months
master - test: raid1 down convert to linear / split and track tests
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=3d1df10af381bd1ae87...
Commit: 3d1df10af381bd1ae87be2209b1a7ff0d1167793
Parent: d250aa7208a6211d54cb2264b767fc3d2063eff8
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Thu Mar 9 04:01:47 2017 +0100
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Thu Mar 9 04:01:47 2017 +0100
test: raid1 down convert to linear / split and track tests
Add/adjust tests for commits d250aa7208a6 and 7fbe6ef16bfb.
---
test/shell/lvconvert-raid.sh | 27 +++++++++++++++++++++++++--
test/shell/lvconvert-thin-raid.sh | 10 +++++++---
2 files changed, 32 insertions(+), 5 deletions(-)
diff --git a/test/shell/lvconvert-raid.sh b/test/shell/lvconvert-raid.sh
index 8538c41..b5bfede 100644
--- a/test/shell/lvconvert-raid.sh
+++ b/test/shell/lvconvert-raid.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright (C) 2011-2012 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2011-2017 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
@@ -72,7 +72,19 @@ for i in 1 2 3; do
lvcreate -aey -s $vg/$lv1 -n snap -l 2
fi
- lvconvert -m $((j - 1)) $vg/$lv1
+ mirrors=$((j - 1))
+ if [ $i -eq 1 ]
+ then
+ [ $mirrors -eq 0 ] && lvconvert -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
+ fi
+ fi
# FIXME: ensure no residual devices
@@ -160,6 +172,17 @@ not fsck.ext4 -fn "$DM_DEV_DIR/mapper/$vg-${lv1}_rimage_2"
# FIXME: ensure no residual devices
lvremove -ff $vg
+# Check split track changes gets rejected w/o -y on 2-legged raid1
+lvcreate --type raid1 -m 1 -l 1 -n $lv1 $vg
+mkfs.ext4 "$DM_DEV_DIR/$vg/$lv1"
+fsck.ext4 -fn "$DM_DEV_DIR/$vg/$lv1"
+aux wait_for_sync $vg $lv1
+fsck.ext4 -fn "$DM_DEV_DIR/$vg/$lv1"
+not lvconvert --splitmirrors 1 --trackchanges $vg/$lv1
+lvconvert -y --splitmirrors 1 --trackchanges $vg/$lv1
+# FIXME: ensure no residual devices
+lvremove -ff $vg
+
###########################################
# Linear to RAID1 conversion ("raid1" default segtype)
###########################################
diff --git a/test/shell/lvconvert-thin-raid.sh b/test/shell/lvconvert-thin-raid.sh
index 33e5b6d..7890350 100644
--- a/test/shell/lvconvert-thin-raid.sh
+++ b/test/shell/lvconvert-thin-raid.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2014-2015 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2014-2017 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
@@ -39,11 +39,15 @@ lvchange -ay $vg
lvconvert --splitmirrors 1 --name data2 $vg/${lv1}_tdata "$dev2"
lvconvert --splitmirrors 1 --name data3 $vg/${lv1}_tdata "$dev3"
-lvconvert --splitmirrors 1 --trackchanges $vg/${lv1}_tdata "$dev4"
+# Check split and track gets rejected on 2-legged raid1
+not lvconvert --splitmirrors 1 --trackchanges $vg/${lv1}_tdata "$dev4"
+lvconvert -y --splitmirrors 1 --trackchanges $vg/${lv1}_tdata "$dev4"
lvconvert --splitmirrors 1 --name meta1 $vg/${lv1}_tmeta "$dev1"
lvconvert --splitmirrors 1 --name meta2 $vg/${lv1}_tmeta "$dev2"
-lvconvert --splitmirrors 1 --trackchanges $vg/${lv1}_tmeta "$dev4"
+# Check split and track gets rejected on 2-legged raid1
+not lvconvert --splitmirrors 1 --trackchanges $vg/${lv1}_tmeta "$dev4"
+lvconvert -y --splitmirrors 1 --trackchanges $vg/${lv1}_tmeta "$dev4"
lvremove -ff $vg/data2 $vg/data3 $vg/meta1 $vg/meta2
6 years, 2 months
master - test: raid split and track tests
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=37f452c8c158c201612...
Commit: 37f452c8c158c2016124f534ef979a6c5802b791
Parent: d250aa7208a6211d54cb2264b767fc3d2063eff8
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Thu Mar 9 03:59:01 2017 +0100
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Thu Mar 9 03:59:01 2017 +0100
test: raid split and track tests
Add/adjust tests for commits d250aa7208a6 and 7fbe6ef16bfb.
---
test/shell/lvconvert-raid.sh | 27 +++++++++++++++++++++++++--
test/shell/lvconvert-thin-raid.sh | 10 +++++++---
2 files changed, 32 insertions(+), 5 deletions(-)
diff --git a/test/shell/lvconvert-raid.sh b/test/shell/lvconvert-raid.sh
index 8538c41..b5bfede 100644
--- a/test/shell/lvconvert-raid.sh
+++ b/test/shell/lvconvert-raid.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright (C) 2011-2012 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2011-2017 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
@@ -72,7 +72,19 @@ for i in 1 2 3; do
lvcreate -aey -s $vg/$lv1 -n snap -l 2
fi
- lvconvert -m $((j - 1)) $vg/$lv1
+ mirrors=$((j - 1))
+ if [ $i -eq 1 ]
+ then
+ [ $mirrors -eq 0 ] && lvconvert -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
+ fi
+ fi
# FIXME: ensure no residual devices
@@ -160,6 +172,17 @@ not fsck.ext4 -fn "$DM_DEV_DIR/mapper/$vg-${lv1}_rimage_2"
# FIXME: ensure no residual devices
lvremove -ff $vg
+# Check split track changes gets rejected w/o -y on 2-legged raid1
+lvcreate --type raid1 -m 1 -l 1 -n $lv1 $vg
+mkfs.ext4 "$DM_DEV_DIR/$vg/$lv1"
+fsck.ext4 -fn "$DM_DEV_DIR/$vg/$lv1"
+aux wait_for_sync $vg $lv1
+fsck.ext4 -fn "$DM_DEV_DIR/$vg/$lv1"
+not lvconvert --splitmirrors 1 --trackchanges $vg/$lv1
+lvconvert -y --splitmirrors 1 --trackchanges $vg/$lv1
+# FIXME: ensure no residual devices
+lvremove -ff $vg
+
###########################################
# Linear to RAID1 conversion ("raid1" default segtype)
###########################################
diff --git a/test/shell/lvconvert-thin-raid.sh b/test/shell/lvconvert-thin-raid.sh
index 33e5b6d..7890350 100644
--- a/test/shell/lvconvert-thin-raid.sh
+++ b/test/shell/lvconvert-thin-raid.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2014-2015 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2014-2017 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
@@ -39,11 +39,15 @@ lvchange -ay $vg
lvconvert --splitmirrors 1 --name data2 $vg/${lv1}_tdata "$dev2"
lvconvert --splitmirrors 1 --name data3 $vg/${lv1}_tdata "$dev3"
-lvconvert --splitmirrors 1 --trackchanges $vg/${lv1}_tdata "$dev4"
+# Check split and track gets rejected on 2-legged raid1
+not lvconvert --splitmirrors 1 --trackchanges $vg/${lv1}_tdata "$dev4"
+lvconvert -y --splitmirrors 1 --trackchanges $vg/${lv1}_tdata "$dev4"
lvconvert --splitmirrors 1 --name meta1 $vg/${lv1}_tmeta "$dev1"
lvconvert --splitmirrors 1 --name meta2 $vg/${lv1}_tmeta "$dev2"
-lvconvert --splitmirrors 1 --trackchanges $vg/${lv1}_tmeta "$dev4"
+# Check split and track gets rejected on 2-legged raid1
+not lvconvert --splitmirrors 1 --trackchanges $vg/${lv1}_tmeta "$dev4"
+lvconvert -y --splitmirrors 1 --trackchanges $vg/${lv1}_tmeta "$dev4"
lvremove -ff $vg/data2 $vg/data3 $vg/meta1 $vg/meta2
6 years, 2 months
master - lvconvert: prompt when splitting off a tracked LV of a 2-legged raid1 LV
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d250aa7208a6211d54c...
Commit: d250aa7208a6211d54cb2264b767fc3d2063eff8
Parent: 7fbe6ef16bfb95ffe7c02e29872ccd2d86445acf
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Thu Mar 9 03:22:55 2017 +0100
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Thu Mar 9 03:22:55 2017 +0100
lvconvert: prompt when splitting off a tracked LV of a 2-legged raid1 LV
Splitting off an image LV of a 2-legged raid1 LV tracking changes
causes loosing partial resilience for any newly written data set.
Full resilience will be provided again after the split off image LV
got merged back in and the new data set got fully synchronized.
Reason being that the data is only stored on the remaining single
writable image during the split.
Ask user to avoid uninformed loss of such partial resilience.
Don't ask for N > 2 legged raid1 LVs.
---
lib/metadata/metadata-exported.h | 1 +
lib/metadata/raid_manip.c | 13 +++++++++++++
tools/lvconvert.c | 2 +-
3 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 28e1f52..1b06354 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -1219,6 +1219,7 @@ int lv_raid_change_image_count(struct logical_volume *lv,
int lv_raid_split(struct logical_volume *lv, const char *split_name,
uint32_t new_count, struct dm_list *splittable_pvs);
int lv_raid_split_and_track(struct logical_volume *lv,
+ int yes,
struct dm_list *splittable_pvs);
int lv_raid_merge(struct logical_volume *lv);
int lv_raid_convert(struct logical_volume *lv,
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index c1788c3..9f1ea8d 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -3228,6 +3228,7 @@ int lv_raid_split(struct logical_volume *lv, const char *split_name,
* Returns: 1 on success, 0 on error
*/
int lv_raid_split_and_track(struct logical_volume *lv,
+ int yes,
struct dm_list *splittable_pvs)
{
int s;
@@ -3250,6 +3251,14 @@ int lv_raid_split_and_track(struct logical_volume *lv,
return 0;
}
+ /* Split and track changes on a 2-legged raid1 LV causes loosing resilience for newly written data. */
+ if (seg->area_count == 2 &&
+ !yes && yes_no_prompt("Are you sure you want to split and track %s LV %s loosing resilience for any newly written data? [y/n]: ",
+ lvseg_name(seg), display_lvname(lv)) == 'n') {
+ log_error("Logical volume %s NOT split.", display_lvname(lv));
+ return 0;
+ }
+
for (s = seg->area_count - 1; s >= 0; --s) {
if (!lv_is_on_pvs(seg_lv(seg, s), splittable_pvs))
continue;
@@ -3275,6 +3284,10 @@ int lv_raid_split_and_track(struct logical_volume *lv,
if (!activate_lv_excl_local(lv->vg->cmd, seg_lv(seg, s)))
return_0;
+ if (seg->area_count == 2)
+ log_warn("Any newly written data will be non-resilient on LV %s during the split!",
+ display_lvname(lv));
+
log_print_unless_silent("Use 'lvconvert --merge %s' to merge back into %s.",
display_lvname(seg_lv(seg, s)),
display_lvname(lv));
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 3110522..4827d6e 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -1346,7 +1346,7 @@ static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *l
}
if (lp->track_changes)
- return lv_raid_split_and_track(lv, lp->pvh);
+ return lv_raid_split_and_track(lv, lp->yes, lp->pvh);
if (lp->keep_mimages)
return lv_raid_split(lv, lp->lv_split_name, image_count, lp->pvh);
6 years, 2 months
master - lvconvert: prompt when converting raid1 to linear
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7fbe6ef16bfb95ffe7c...
Commit: 7fbe6ef16bfb95ffe7c02e29872ccd2d86445acf
Parent: 8daad1166608cd99beca7fb23223a9ed66353e40
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Thu Mar 9 02:39:49 2017 +0100
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Thu Mar 9 02:39:49 2017 +0100
lvconvert: prompt when converting raid1 to linear
Ask user when converting raid1 to linear to avoid
uninformed loss of all resilience.
---
lib/metadata/metadata-exported.h | 1 +
lib/metadata/raid_manip.c | 28 +++++++++++++++++-----------
tools/lvconvert.c | 2 +-
3 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 4960499..28e1f52 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -1212,6 +1212,7 @@ struct logical_volume *first_replicator_dev(const struct logical_volume *lv);
int lv_is_raid_with_tracking(const struct logical_volume *lv);
uint32_t lv_raid_image_count(const struct logical_volume *lv);
int lv_raid_change_image_count(struct logical_volume *lv,
+ int yes,
uint32_t new_count,
uint32_t new_region_size,
struct dm_list *allocate_pvs);
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 68b1b85..c1788c3 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -1712,7 +1712,7 @@ static int _reshape_adjust_to_size(struct logical_volume *lv,
* Reshape: add immages to existing raid lv
*
*/
-static int _lv_raid_change_image_count(struct logical_volume *lv, uint32_t new_count,
+static int _lv_raid_change_image_count(struct logical_volume *lv, int yes, uint32_t new_count,
struct dm_list *allocate_pvs, struct dm_list *removal_lvs,
int commit, int use_existing_area_len);
static int _raid_reshape_add_images(struct logical_volume *lv,
@@ -1773,7 +1773,7 @@ static int _raid_reshape_add_images(struct logical_volume *lv,
log_debug_metadata("Adding %u data and metadata image LV pair%s to %s.",
new_image_count - old_image_count, new_image_count - old_image_count > 1 ? "s" : "",
display_lvname(lv));
- if (!_lv_raid_change_image_count(lv, new_image_count, allocate_pvs, NULL, 0, 0))
+ if (!_lv_raid_change_image_count(lv, 1, new_image_count, allocate_pvs, NULL, 0, 0))
return 0;
/* Reshape adding image component pairs -> change sizes/counters accordingly */
@@ -1949,7 +1949,7 @@ static int _raid_reshape_remove_images(struct logical_volume *lv,
log_debug_metadata("Removing %u data and metadata image LV pair%s from %s.",
old_image_count - new_image_count, old_image_count - new_image_count > 1 ? "s" : "",
display_lvname(lv));
- if (!_lv_raid_change_image_count(lv, new_image_count, allocate_pvs, removal_lvs, 0, 0))
+ if (!_lv_raid_change_image_count(lv, 1, new_image_count, allocate_pvs, removal_lvs, 0, 0))
return 0;
seg->area_count = new_image_count;
@@ -2959,7 +2959,7 @@ static int _raid_extract_images(struct logical_volume *lv,
return 1;
}
-static int _raid_remove_images(struct logical_volume *lv,
+static int _raid_remove_images(struct logical_volume *lv, int yes,
uint32_t new_count, struct dm_list *allocate_pvs,
struct dm_list *removal_lvs, int commit)
{
@@ -2982,6 +2982,12 @@ static int _raid_remove_images(struct logical_volume *lv,
/* 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]: ",
+ lvseg_name(first_seg(lv)), display_lvname(lv), SEG_TYPE_NAME_LINEAR) == 'n') {
+ log_error("Logical volume %s NOT converted to \"%s\".",
+ display_lvname(lv), SEG_TYPE_NAME_LINEAR);
+ return 0;
+ }
if (!_raid_remove_top_layer(lv, removal_lvs)) {
log_error("Failed to remove RAID layer "
"after linear conversion.");
@@ -3024,7 +3030,7 @@ static int _raid_remove_images(struct logical_volume *lv,
* This function adds or removes _both_ portions of the image and commits
* the results.
*/
-static int _lv_raid_change_image_count(struct logical_volume *lv, uint32_t new_count,
+static int _lv_raid_change_image_count(struct logical_volume *lv, int yes, uint32_t new_count,
struct dm_list *allocate_pvs, struct dm_list *removal_lvs,
int commit, int use_existing_area_len)
{
@@ -3047,12 +3053,12 @@ static int _lv_raid_change_image_count(struct logical_volume *lv, uint32_t new_c
}
if (old_count > new_count)
- return _raid_remove_images(lv, new_count, allocate_pvs, removal_lvs, commit);
+ return _raid_remove_images(lv, yes, new_count, allocate_pvs, removal_lvs, commit);
return _raid_add_images(lv, new_count, allocate_pvs, commit, use_existing_area_len);
}
-int lv_raid_change_image_count(struct logical_volume *lv, uint32_t new_count,
+int lv_raid_change_image_count(struct logical_volume *lv, int yes, uint32_t new_count,
const uint32_t new_region_size, struct dm_list *allocate_pvs)
{
struct lv_segment *seg = first_seg(lv);
@@ -3062,7 +3068,7 @@ int lv_raid_change_image_count(struct logical_volume *lv, uint32_t new_count,
_check_and_adjust_region_size(lv);
}
- return _lv_raid_change_image_count(lv, new_count, allocate_pvs, NULL, 1, 0);
+ return _lv_raid_change_image_count(lv, yes, new_count, allocate_pvs, NULL, 1, 0);
}
int lv_raid_split(struct logical_volume *lv, const char *split_name,
@@ -3886,7 +3892,7 @@ static int _convert_raid1_to_mirror(struct logical_volume *lv,
if (new_image_count != seg->area_count) {
log_debug_metadata("Changing image count to %u on %s.",
new_image_count, display_lvname(lv));
- if (!_lv_raid_change_image_count(lv, new_image_count, allocate_pvs, removal_lvs, 0, 0))
+ if (!_lv_raid_change_image_count(lv, 1, new_image_count, allocate_pvs, removal_lvs, 0, 0))
return_0;
}
@@ -4886,7 +4892,7 @@ static int _takeover_downconvert_wrapper(TAKEOVER_FN_ARGS)
log_debug_metadata("Removing %" PRIu32 " component LV pair(s) to %s.",
lv_raid_image_count(lv) - new_image_count,
display_lvname(lv));
- if (!_lv_raid_change_image_count(lv, new_image_count, allocate_pvs, &removal_lvs, 0, 0))
+ if (!_lv_raid_change_image_count(lv, 1, new_image_count, allocate_pvs, &removal_lvs, 0, 0))
return 0;
seg->area_count = new_image_count;
@@ -5135,7 +5141,7 @@ static int _takeover_upconvert_wrapper(TAKEOVER_FN_ARGS)
log_debug_metadata("Adding %" PRIu32 " component LV pair(s) to %s.",
new_image_count - lv_raid_image_count(lv),
display_lvname(lv));
- if (!_lv_raid_change_image_count(lv, new_image_count, allocate_pvs, NULL, 0, 1))
+ if (!_lv_raid_change_image_count(lv, 1, new_image_count, allocate_pvs, NULL, 0, 1))
return 0;
seg = first_seg(lv);
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 97d17e4..3110522 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -1359,7 +1359,7 @@ static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *l
DEFAULT_RAID1_MAX_IMAGES, lp->segtype->name, display_lvname(lv));
return 0;
}
- if (!lv_raid_change_image_count(lv, image_count, lp->region_size, lp->pvh))
+ if (!lv_raid_change_image_count(lv, lp->yes, image_count, lp->region_size, lp->pvh))
return_0;
log_print_unless_silent("Logical volume %s successfully converted.",
6 years, 2 months
master - test: "lvconvert --repair" after vgreduce
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=8daad1166608cd99bec...
Commit: 8daad1166608cd99beca7fb23223a9ed66353e40
Parent: 90ed3d5e8c977d632911746c2faf09f60ddbeacc
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Thu Mar 9 02:35:57 2017 +0100
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Thu Mar 9 02:35:57 2017 +0100
test: "lvconvert --repair" after vgreduce
Add test for commit 921b496fff51.
---
test/shell/lvconvert-repair-raid.sh | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/test/shell/lvconvert-repair-raid.sh b/test/shell/lvconvert-repair-raid.sh
index 3052f5c..b25d861 100644
--- a/test/shell/lvconvert-repair-raid.sh
+++ b/test/shell/lvconvert-repair-raid.sh
@@ -72,9 +72,10 @@ delay 0
lvcreate --type raid5 -i 2 -L $RAID_SIZE -n $lv1 $vg "$dev1" "$dev2" "$dev3"
aux wait_for_sync $vg $lv1
aux disable_dev "$dev3"
+vgreduce --removemissing -f $vg
lvconvert -y --repair $vg/$lv1
-vgreduce --removemissing $vg
aux enable_dev "$dev3"
+pvcreate -yff "$dev3"
vgextend $vg "$dev3"
lvremove -ff $vg/$lv1
6 years, 2 months
master - raid: fix function description
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=90ed3d5e8c977d63291...
Commit: 90ed3d5e8c977d632911746c2faf09f60ddbeacc
Parent: 921b496fff51822a851447d3e8f3b93a192b4aea
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Thu Mar 9 02:16:03 2017 +0100
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Thu Mar 9 02:16:03 2017 +0100
raid: fix function description
---
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 2f30252..68b1b85 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -2087,7 +2087,7 @@ static int _activate_sub_lvs_excl_local(struct logical_volume *lv, uint32_t star
return 1;
}
-/* Helper: function to activate any sub LVs of @lv exclusively local starting with area indexed by @start_idx */
+/* Helper: function to activate any LVs on @lv_list */
static int _activate_sub_lvs_excl_local_list(struct logical_volume *lv, struct dm_list *lv_list)
{
int r = 1;
6 years, 2 months
master - lvconvert: fix --repair after vgreduce
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=921b496fff51822a851...
Commit: 921b496fff51822a851447d3e8f3b93a192b4aea
Parent: 00b8c2bebc274ba783f6b0f0b27f07ec858c7310
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Thu Mar 9 02:11:52 2017 +0100
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Thu Mar 9 02:11:52 2017 +0100
lvconvert: fix --repair after vgreduce
In case N images fail (N <= parity chunks) _and_
a "vgreduce --removemissing --force VG" was applied
a following repair of the RaidLV fails:
Unable to remove N images: Only 0 devices given.
Failed to remove the specified images from tb/r.
Failed to replace faulty devices in tb/r.
Fix as of this commit results in correct repair:
Faulty devices in tb/r successfully replaced.
---
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 d109c0a..2f30252 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -6275,7 +6275,7 @@ try_again:
*/
if (!_raid_extract_images(lv, force,
raid_seg->area_count - match_count,
- partial_segment_removed ?
+ (partial_segment_removed || !dm_list_size(remove_pvs)) ?
&lv->vg->pvs : remove_pvs, 0,
&old_lvs, &old_lvs)) {
log_error("Failed to remove the specified images from %s.",
6 years, 2 months
master - test: Copyright
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=00b8c2bebc274ba783f...
Commit: 00b8c2bebc274ba783f6b0f0b27f07ec858c7310
Parent: b4e78b26f53194ef8b3b1e623715c96db1046e42
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Thu Mar 9 00:10:55 2017 +0100
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Thu Mar 9 00:10:55 2017 +0100
test: Copyright
---
test/shell/relative-sign-options.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/shell/relative-sign-options.sh b/test/shell/relative-sign-options.sh
index 00f5791..314f6b1 100644
--- a/test/shell/relative-sign-options.sh
+++ b/test/shell/relative-sign-options.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright (C) 2008-2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2017 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
6 years, 2 months