mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-28 02:50:41 +03:00
vgsplit: Improve message when LV still active.
Mention parent LV as well as the LV triggering the warning. Still leaves some confusing cases but its not worth fixing them at the moment. (Thin pool inactive but a thin volume active => deactivate thin vol. Inactive mirror/raid with pvmove in progress => complete pvmove and active&deactivate mirror/raid. If new VG already exists it requires some LVs to be inactive unnecessarily.)
This commit is contained in:
parent
137ed3081a
commit
ac60c876c4
@ -231,22 +231,29 @@ char *lv_fullname_dup(struct dm_pool *mem, const struct logical_volume *lv)
|
||||
return dm_pool_strdup(mem, lvfullname);
|
||||
}
|
||||
|
||||
char *lv_parent_dup(struct dm_pool *mem, const struct logical_volume *lv)
|
||||
struct logical_volume *lv_parent(const struct logical_volume *lv)
|
||||
{
|
||||
const char *parent = "";
|
||||
struct logical_volume *parent_lv = NULL;
|
||||
|
||||
if (lv_is_visible(lv))
|
||||
;
|
||||
else if (lv_is_mirror_image(lv) || lv_is_mirror_log(lv))
|
||||
parent = get_only_segment_using_this_lv(lv)->lv->name;
|
||||
parent_lv = get_only_segment_using_this_lv(lv)->lv;
|
||||
else if (lv_is_raid_image(lv) || lv_is_raid_metadata(lv))
|
||||
parent = get_only_segment_using_this_lv(lv)->lv->name;
|
||||
parent_lv = get_only_segment_using_this_lv(lv)->lv;
|
||||
else if (lv_is_cache_pool_data(lv) || lv_is_cache_pool_metadata(lv))
|
||||
parent = get_only_segment_using_this_lv(lv)->lv->name;
|
||||
parent_lv = get_only_segment_using_this_lv(lv)->lv;
|
||||
else if (lv_is_thin_pool_data(lv) || lv_is_thin_pool_metadata(lv))
|
||||
parent = get_only_segment_using_this_lv(lv)->lv->name;
|
||||
parent_lv = get_only_segment_using_this_lv(lv)->lv;
|
||||
|
||||
return dm_pool_strdup(mem, parent);
|
||||
return parent_lv;
|
||||
}
|
||||
|
||||
char *lv_parent_dup(struct dm_pool *mem, const struct logical_volume *lv)
|
||||
{
|
||||
struct logical_volume *parent_lv = lv_parent(lv);
|
||||
|
||||
return dm_pool_strdup(mem, parent_lv ? parent_lv->name : "");
|
||||
}
|
||||
|
||||
char *lv_modules_dup(struct dm_pool *mem, const struct logical_volume *lv)
|
||||
|
@ -73,6 +73,7 @@ char *lv_pool_lv_dup(struct dm_pool *mem, const struct logical_volume *lv);
|
||||
char *lv_modules_dup(struct dm_pool *mem, const struct logical_volume *lv);
|
||||
char *lv_name_dup(struct dm_pool *mem, const struct logical_volume *lv);
|
||||
char *lv_fullname_dup(struct dm_pool *mem, const struct logical_volume *lv);
|
||||
struct logical_volume *lv_parent(const struct logical_volume *lv);
|
||||
char *lv_parent_dup(struct dm_pool *mem, const struct logical_volume *lv);
|
||||
char *lv_origin_dup(struct dm_pool *mem, const struct logical_volume *lv);
|
||||
uint32_t lv_kernel_read_ahead(const struct logical_volume *lv);
|
||||
|
@ -18,10 +18,10 @@
|
||||
|
||||
static int _lv_is_in_vg(struct volume_group *vg, struct logical_volume *lv)
|
||||
{
|
||||
if (lv->vg == vg)
|
||||
return 1;
|
||||
if (!lv || lv->vg != vg)
|
||||
return 0;
|
||||
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int _move_one_lv(struct volume_group *vg_from,
|
||||
@ -29,9 +29,13 @@ static int _move_one_lv(struct volume_group *vg_from,
|
||||
struct dm_list *lvh)
|
||||
{
|
||||
struct logical_volume *lv = dm_list_item(lvh, struct lv_list)->lv;
|
||||
struct logical_volume *parent_lv;
|
||||
|
||||
if (lv_is_active(lv)) {
|
||||
log_error("Logical volume \"%s\" must be inactive", lv->name);
|
||||
if ((parent_lv = lv_parent(lv)))
|
||||
log_error("Logical volume %s (part of %s) must be inactive.", display_lvname(lv), parent_lv->name);
|
||||
else
|
||||
log_error("Logical volume %s must be inactive.", display_lvname(lv));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user