summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Brassow <jbrassow@redhat.com>2012-09-05 14:32:06 -0500
committerJonathan Brassow <jbrassow@redhat.com>2012-09-05 14:32:06 -0500
commitb49b98d50c558a142d0a2ef55279eea00bd36eba (patch)
treeaf1c52c925e2f9ac3b36761df0874557fd0c2915
parentc3eb3a76875ccf8c544c991bc52b6b3061bf8f58 (diff)
downloadlvm2-b49b98d50c558a142d0a2ef55279eea00bd36eba.tar.gz
lvm2-b49b98d50c558a142d0a2ef55279eea00bd36eba.tar.xz
lvm2-b49b98d50c558a142d0a2ef55279eea00bd36eba.zip
RAID: '--test' should not cause a valid create command to fail
It is necessary when creating a RAID LV to clear the new metadata areas. Failure to do so could result in a prepopulated bitmap that would cause the new array to skip syncing portions of the array. It is a requirement that the metadata LVs be activated and cleared in the process of creating. However in test mode, this requirement should be lifted - no new LVs should be created or written to.
-rw-r--r--WHATS_NEW1
-rw-r--r--lib/metadata/lv_manip.c6
-rw-r--r--lib/metadata/raid_manip.c3
3 files changed, 10 insertions, 0 deletions
diff --git a/WHATS_NEW b/WHATS_NEW
index 28d1908d..8718a0bb 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.98 -
=================================
+ Fix RAID LV creation with '--test' so valid commands do not fail.
Add lvm_lv_rename() to lvm2api.
Fix setvbuf code by closing and reopening stream before changing buffer.
Disable private buffering when using liblvm.
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 617d4b71..3702cafe 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -2623,6 +2623,12 @@ static int _lv_extend_layered_lv(struct alloc_handle *ah,
for (s = 0; s < seg->area_count; s++) {
meta_lv = seg_metalv(seg, s);
+
+ if (test_mode()) {
+ lv_set_hidden(meta_lv);
+ continue;
+ }
+
if (!activate_lv(meta_lv->vg->cmd, meta_lv)) {
log_error("Failed to activate %s/%s for clearing",
meta_lv->vg->name, meta_lv->name);
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index c786a7dd..b5552cb4 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -304,6 +304,9 @@ static int _clear_lv(struct logical_volume *lv)
{
int was_active = lv_is_active(lv);
+ if (test_mode())
+ return 1;
+
if (!was_active && !activate_lv(lv->vg->cmd, lv)) {
log_error("Failed to activate %s for clearing",
lv->name);