diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2015-01-28 13:39:41 +0100 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2015-01-28 13:45:18 +0100 |
commit | 93b90157605f557cd4b0e48c38e6f290eaa871b1 (patch) | |
tree | eb43e3cb686febb6ef74ac3880f69ff3b536640a | |
parent | b254d330e4410e3eb10ab65fbe892ba56f95e2e9 (diff) | |
download | lvm2-93b90157605f557cd4b0e48c38e6f290eaa871b1.tar.gz |
raid: fix raid image splitting
When raid leg is extracted, now the preload code handles this state
correctly and put proper new table entry into dm tree,
so the activation of extracted leg and removed metadata works
after commit.
-rw-r--r-- | WHATS_NEW | 1 | ||||
-rw-r--r-- | lib/metadata/raid_manip.c | 30 | ||||
-rw-r--r-- | test/shell/lvconvert-raid.sh | 6 |
3 files changed, 17 insertions, 20 deletions
@@ -1,5 +1,6 @@ Version 2.02.116 - ==================================== + Fix raid --splitmirror 1 functionality (2.02.112). Fix tree preload to handle splitting raid images. Do not support unpartitioned DASD devices. Improve config validation to check if setting with string value can be empty. diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c index 5c2ca95ae..4ce84a0fd 100644 --- a/lib/metadata/raid_manip.c +++ b/lib/metadata/raid_manip.c @@ -1149,12 +1149,6 @@ int lv_raid_split(struct logical_volume *lv, const char *split_name, return 0; } - if (!resume_lv(lv->vg->cmd, lv_lock_holder(lv))) { - log_error("Failed to resume %s/%s after committing changes", - lv->vg->name, lv->name); - return 0; - } - /* * First activate the newly split LV and LVs on the removal list. * This is necessary so that there are no name collisions due to @@ -1164,26 +1158,22 @@ int lv_raid_split(struct logical_volume *lv, const char *split_name, if (!activate_lv_excl_local(cmd, lvl->lv)) return_0; + dm_list_iterate_items(lvl, &removal_list) + if (!activate_lv_excl_local(cmd, lvl->lv)) + return_0; + + if (!resume_lv(cmd, lv_lock_holder(lv))) { + log_error("Failed to resume %s/%s after committing changes", + lv->vg->name, lv->name); + return 0; + } + /* * Since newly split LV is typically already active - we need to call * suspend() and resume() to also rename it. * * TODO: activate should recognize it and avoid these 2 calls */ - if (!suspend_lv(cmd, lvl->lv)) { - log_error("Failed to suspend %s.", lvl->lv->name); - return 0; - } - - if (!resume_lv(cmd, lvl->lv)) { - log_error("Failed to reactivate %s.", lvl->lv->name); - return 0; - } - - dm_list_iterate_items(lvl, &removal_list) - if (!activate_lv_excl_local(cmd, lvl->lv)) - return_0; - /* * Eliminate the residual LVs diff --git a/test/shell/lvconvert-raid.sh b/test/shell/lvconvert-raid.sh index 8621311a3..12e042094 100644 --- a/test/shell/lvconvert-raid.sh +++ b/test/shell/lvconvert-raid.sh @@ -121,6 +121,12 @@ check active $vg $lv2 # FIXME: ensure no residual devices lvremove -ff $vg +# 4-way +lvcreate --type raid1 -m 4 -l 2 -n $lv1 $vg +aux wait_for_sync $vg $lv1 +lvconvert --yes --splitmirrors 1 --name $lv2 $vg/$lv1 "$dev2" +lvremove -ff $vg + ########################################### # RAID1 split + trackchanges / merge ########################################### |