diff options
author | Heinz Mauelshagen <heinzm@redhat.com> | 2016-08-13 00:20:01 +0200 |
---|---|---|
committer | Heinz Mauelshagen <heinzm@redhat.com> | 2016-08-13 00:20:01 +0200 |
commit | 9c9b9b276a35dcc6dce8e6a19e7afc01eef451a7 (patch) | |
tree | d0bbe00a66bbad679c70b89050550a82d0f925e4 | |
parent | 6d52b17dfcbbbc19d4fee1ba117448bed3759ba8 (diff) | |
download | lvm2-9c9b9b276a35dcc6dce8e6a19e7afc01eef451a7.tar.gz |
raid_manip: pay attention to PVs listed on command line when allocating MetaLVs
Adding MetaLVs to given DataLVs (e.g. raid0 -> raid0_meta takeover) wasn't
paying attention to any PVs listed on the lvconvert command line.
-rw-r--r-- | lib/metadata/raid_manip.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c index 831b1ddc2..a7814a806 100644 --- a/lib/metadata/raid_manip.c +++ b/lib/metadata/raid_manip.c @@ -1604,10 +1604,21 @@ static int _alloc_rmeta_devs_for_rimage_devs(struct logical_volume *lv, dm_list_iterate_items(lvl, new_data_lvs) { log_debug_metadata("Allocating new metadata LV for %s", lvl->lv->name); - if (!_alloc_rmeta_for_lv(lvl->lv, &lvl_array[a].lv, allocate_pvs)) { - log_error("Failed to allocate metadata LV for %s in %s", - lvl->lv->name, lv->vg->name); - return 0; + /* + * Try to collocate with DataLV first and + * if that fails allocate on different PV. + */ + if (!_alloc_rmeta_for_lv(lvl->lv, &lvl_array[a].lv, + allocate_pvs != &lv->vg->pvs ? allocate_pvs : NULL)) { + dm_list_iterate_items(lvl1, new_meta_lvs) + if (!_avoid_pvs_with_other_images_of_lv(lvl1->lv, allocate_pvs)) + return_0; + + if (!_alloc_rmeta_for_lv(lvl->lv, &lvl_array[a].lv, allocate_pvs)) { + log_error("Failed to allocate metadata LV for %s in %s", + lvl->lv->name, lv->vg->name); + return 0; + } } dm_list_add(new_meta_lvs, &lvl_array[a++].list); |