mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
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.
This commit is contained in:
parent
7fbe6ef16b
commit
d250aa7208
@ -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,
|
||||
|
@ -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));
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user