1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

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.
This commit is contained in:
Zdenek Kabelac 2015-01-28 13:39:41 +01:00
parent b254d330e4
commit 93b9015760
3 changed files with 17 additions and 20 deletions

View File

@ -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.

View File

@ -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

View File

@ -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
###########################################