1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-10 16:58:47 +03:00

lvconvert: support for convertsion with active component devices

If componet devices could be activated alone, ensure they are not breaking
common commands.

TODO: mostly likely this is not a definite list of all needed checks
and more will come later.
This commit is contained in:
Zdenek Kabelac 2018-03-02 16:34:09 +01:00
parent f92b6f9930
commit 6134a71a90
3 changed files with 20 additions and 5 deletions

View File

@ -548,11 +548,8 @@ int lv_cache_remove(struct logical_volume *cache_lv)
/* Localy active volume is needed for writeback */
if (!lv_info(cache_lv->vg->cmd, cache_lv, 1, NULL, 0, 0)) {
/* Give up any remote locks */
if (!deactivate_lv(cache_lv->vg->cmd, cache_lv)) {
log_error("Cannot deactivate remotely active cache volume %s.",
display_lvname(cache_lv));
return 0;
}
if (!deactivate_lv_with_sub_lv(cache_lv))
return_0;
switch (first_seg(cache_seg->pool_lv)->cache_mode) {
case CACHE_MODE_WRITETHROUGH:

View File

@ -4872,6 +4872,12 @@ static int _lvresize_check(struct logical_volume *lv,
lp->mirrors = 0;
}
if (lv_component_is_active(lv)) {
log_error("Cannot resize logical volume %s with active component LV(s).",
display_lvname(lv));
return 0;
}
return 1;
}

View File

@ -833,6 +833,12 @@ static int _lvconvert_mirrors_aux(struct cmd_context *cmd,
return 1;
}
if (lv_component_is_active(lv)) {
log_error("Cannot convert logical volume %s with active component LV(s).",
display_lvname(lv));
return 0;
}
region_size = adjusted_mirror_region_size(cmd, lv->vg->extent_size,
lv->le_count,
lp->region_size ? : seg->region_size, 0,
@ -1950,6 +1956,12 @@ static int _lvconvert_snapshot(struct cmd_context *cmd,
if (!validate_snapshot_origin(org))
return_0;
if (lv_component_is_active(org)) {
log_error("Cannot use logical volume %s with active component LVs for snapshot origin.",
display_lvname(org));
return 0;
}
log_warn("WARNING: Converting logical volume %s to snapshot exception store.",
snap_name);
log_warn("THIS WILL DESTROY CONTENT OF LOGICAL VOLUME (filesystem etc.)");