mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
cache: support vgsplit
Enable vgsplit to work with VG containing cached LVs.
This commit is contained in:
parent
1cc690e911
commit
030c39073e
@ -1,5 +1,6 @@
|
||||
Version 2.03.02 -
|
||||
===================================
|
||||
Add support for vgsplit with cached devices.
|
||||
Query mpath device only once per command for its state.
|
||||
Use device INFO instead of STATUS when checking for mpath device uuid.
|
||||
Change default io_memory_size from 4 to 8 MiB.
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
* Copyright (C) 2004-2009,2016 Red Hat, Inc. All rights reserved.
|
||||
* Copyright (C) 2004-2019 Red Hat, Inc. All rights reserved.
|
||||
*
|
||||
* This file is part of LVM2.
|
||||
*
|
||||
@ -384,71 +384,60 @@ static int _move_cache(struct volume_group *vg_from,
|
||||
|
||||
dm_list_iterate_safe(lvh, lvht, &vg_from->lvs) {
|
||||
lv = dm_list_item(lvh, struct lv_list)->lv;
|
||||
data = meta = orig = NULL;
|
||||
seg = first_seg(lv);
|
||||
|
||||
if (!lv_is_cache(lv) && !lv_is_cache_pool(lv))
|
||||
continue;
|
||||
|
||||
/*
|
||||
* FIXME: The code seems to move cache LVs fine, but it
|
||||
* hasn't been well tested and it causes problems
|
||||
* when just splitting PVs that don't contain
|
||||
* cache LVs.
|
||||
* Waiting for next release before fixing and enabling.
|
||||
*/
|
||||
log_error("Unable to split VG while it contains cache LVs");
|
||||
return 0;
|
||||
|
||||
/* NOTREACHED */
|
||||
|
||||
if (lv_is_cache(lv) && lv_is_cache_vol(seg->pool_lv)) {
|
||||
log_error("Cannot split while LV %s has cache attached.", display_lvname(lv));
|
||||
return 0;
|
||||
} else if (lv_is_cache(lv)) {
|
||||
}
|
||||
|
||||
if (lv_is_cache(lv)) {
|
||||
orig = seg_lv(seg, 0);
|
||||
data = seg_lv(first_seg(seg->pool_lv), 0);
|
||||
meta = first_seg(seg->pool_lv)->metadata_lv;
|
||||
/* Ensure all components are coming along */
|
||||
is_moving = _lv_is_in_vg(vg_to, orig);
|
||||
} else {
|
||||
if (!dm_list_empty(&seg->lv->segs_using_this_lv) &&
|
||||
!(cache_seg = get_only_segment_using_this_lv(seg->lv)))
|
||||
seg = first_seg(seg->pool_lv);
|
||||
} else { /* lv_is_cache_pool */
|
||||
orig = NULL;
|
||||
if (!dm_list_empty(&seg->lv->segs_using_this_lv)) {
|
||||
if (!(cache_seg = get_only_segment_using_this_lv(seg->lv)))
|
||||
return_0;
|
||||
orig = seg_lv(cache_seg, 0);
|
||||
}
|
||||
}
|
||||
|
||||
data = seg_lv(seg, 0);
|
||||
meta = seg->metadata_lv;
|
||||
|
||||
if (_lv_is_in_vg(vg_to, data) ||
|
||||
_lv_is_in_vg(vg_to, meta))
|
||||
is_moving = 1;
|
||||
}
|
||||
|
||||
if (!lv_is_on_pvs(data, &vg_to->pvs))
|
||||
if ((orig && !lv_is_on_pvs(orig, &vg_to->pvs)) &&
|
||||
!lv_is_on_pvs(data, &vg_to->pvs) &&
|
||||
!lv_is_on_pvs(meta, &vg_to->pvs))
|
||||
continue;
|
||||
|
||||
if (!lv_is_on_pvs(meta, &vg_to->pvs))
|
||||
continue;
|
||||
/* Ensure all components are coming along */
|
||||
if (orig) {
|
||||
is_moving = _lv_is_in_vg(vg_to, orig);
|
||||
|
||||
if (orig && (_lv_is_in_vg(vg_to, orig) != is_moving)) {
|
||||
log_error("Can't split %s and its origin (%s)"
|
||||
" into separate VGs", lv->name, orig->name);
|
||||
if (_lv_is_in_vg(vg_to, data) != is_moving) {
|
||||
log_error("Cannot split cache origin %s and its cache pool data %s "
|
||||
"into separate VGs.",
|
||||
display_lvname(orig), display_lvname(data));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (data && (_lv_is_in_vg(vg_to, data) != is_moving)) {
|
||||
log_error("Can't split %s and its cache pool"
|
||||
" data LV (%s) into separate VGs",
|
||||
lv->name, data->name);
|
||||
if (_lv_is_in_vg(vg_to, meta) != is_moving) {
|
||||
log_error("Cannot split cache origin %s and its cache pool metadata %s "
|
||||
"into separate VGs.",
|
||||
display_lvname(orig), display_lvname(meta));
|
||||
return 0;
|
||||
}
|
||||
} else if (_lv_is_in_vg(vg_to, data) != _lv_is_in_vg(vg_to, meta)) {
|
||||
log_error("Cannot split cache pool data %s and its metadata %s "
|
||||
"into separate VGs.",
|
||||
display_lvname(data), display_lvname(meta));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (meta && (_lv_is_in_vg(vg_to, meta) != is_moving)) {
|
||||
log_error("Can't split %s and its cache pool"
|
||||
" metadata LV (%s) into separate VGs",
|
||||
lv->name, meta->name);
|
||||
return 0;
|
||||
}
|
||||
if (!_move_one_lv(vg_from, vg_to, lvh, &lvht))
|
||||
return_0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user