1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-08-23 05:49:28 +03:00

Compare commits

..

9 Commits

Author SHA1 Message Date
a3f77ed4ba pre-release 2015-11-09 01:45:22 +00:00
b9341e36f1 test: disable duplicate VG name test for lvmetad
Until we decide how duplicate VG names should be
handled by lvmetad, and implement that.
2015-11-06 15:58:22 -06:00
8096f2224c mirror: Fix log size calc when more than 1 extent.
Currently the code creates the log separately after allocating space for
the data and as no data allocation is needed this second time,
total_extents ends up holding zero so use new_extents directly instead.
2015-11-05 23:40:47 +00:00
16780f6faa vg_read: skip repair and wipe for foreign and shared VGs
When reading a foreign VG we cannot write it, since
it belongs to another host.  When reading a shared VG
we cannot write it because we may not have an ex lock.
(Or we may be reading the shared VG while not using
lvmlockd in which case it's like reading a foreign VG.)

Add the same checks for wiping outdated PVs.  We may
read a foreign or shared VG, or see the PVs, while
another host is part way through writing a new version
of the VG to the PVs.  This might cause us to think
some of the PVs are outdated.  We do not want to
write another host's PVs, especially when we may
wrongly conclude they are outdated.
2015-11-03 13:42:21 -06:00
4103896ca0 lvmcache: change log_verbose to log_warn
Without this, some cases miss printing a
warning for duplicate PVs.
2015-11-03 13:37:31 -06:00
d30105f471 lvmetad: log duplicate PVs returned from lvmetad
When the command gets a list of alternate devices
from lvmetad, log each one directly.  This is not
the same as the warnings when adding lvmcache,
which are related to which duplicate is preferred.
2015-11-03 13:35:51 -06:00
19feda2c95 tests: skip duplicate vg names test with lvmetad
If two PVs have different VGs with the same name
(different uuids), one of the VGs is ignored by
lvmetad.  A FIXME exists in lvmetad to find a
better response.
2015-11-03 13:25:35 -06:00
4e6377f5ba lvmetad: refactor and document
update_metadata and pv_found update the cached metadata;
these are both reworked to improve the code, organize it
by each possible state and transition, make it much more
clear what's changing, add more error checking and
handling, and add comments.

The state and content of the cache (hash tables) does not
change (apart from some things that didn't work before),
and the communication to/from commands does not change.
The implementation and organization of the code making
the state changes does change significantly.

One detail related to the content of the cache does change:
different hash tables do not reference the same memory any more;
the target values in each hash table are allocated and freed
individually.
2015-11-03 13:18:27 -06:00
4b47ee5296 config: fix copy error in examples
The same example was copied without
changing the variable name.
2015-11-03 11:07:27 -06:00
12 changed files with 1678 additions and 336 deletions

View File

@ -1 +1 @@
2.02.134(2)-git (2015-10-30)
2.02.134(2)-git (2015-11-09)

View File

@ -1 +1 @@
1.02.111-git (2015-10-30)
1.02.110-git (2015-11-09)

View File

@ -1,5 +1,8 @@
Version 2.02.134 -
Version 2.02.134 - 9th November 2015
====================================
Refactor some lvmetad code and adjust some duplicate PV messages.
No longer repair/wipe VG/PVs if inaccessible because foreign or shared.
Pass correct data size to mirror log calc so log can be bigger than 1 extent.
Version 2.02.133 - 30th October 2015
====================================

View File

@ -1,6 +1,3 @@
Version 1.02.111 -
====================================
Version 1.02.110 - 30th October 2015
====================================
Disable thin monitoring plugin when it fails too often (>10 times).

File diff suppressed because it is too large Load Diff

View File

@ -1784,9 +1784,9 @@ struct lvmcache_info *lvmcache_add(struct labeller *labeller, const char *pvid,
* been chosen during a previous populating of
* lvmcache, so just use the existing preferences.
*/
log_verbose("Found duplicate PV %s: using existing dev %s",
pvid_s,
dev_name(existing->dev));
log_warn("Found duplicate PV %s: using existing dev %s",
pvid_s,
dev_name(existing->dev));
return NULL;
}

11
lib/cache/lvmetad.c vendored
View File

@ -439,6 +439,14 @@ static int _pv_populate_lvmcache(struct cmd_context *cmd,
while (alt_device) {
dev_alternate = dev_cache_get_by_devt(alt_device->v.i, cmd->filter);
log_verbose("PV on device %s (%d:%d %d) is also on device %s (%d:%d %d) %s",
dev_name(dev),
(int)MAJOR(devt), (int)MINOR(devt), (int)devt,
dev_alternate ? dev_name(dev_alternate) : "unknown",
(int)MAJOR(alt_device->v.i), (int)MINOR(alt_device->v.i), (int)alt_device->v.i,
pvid_txt);
if (dev_alternate) {
if ((info_alternate = lvmcache_add(fmt->labeller, (const char *)&pvid, dev_alternate,
vgname, (const char *)&vgid, 0))) {
@ -446,9 +454,6 @@ static int _pv_populate_lvmcache(struct cmd_context *cmd,
info = info_alternate;
lvmcache_get_label(info)->dev = dev_alternate;
}
} else {
log_warn("Duplicate of PV %s dev %s exists on unknown device %"PRId64 ":%" PRId64,
pvid_txt, dev_name(dev), MAJOR(alt_device->v.i), MINOR(alt_device->v.i));
}
alt_device = alt_device->next;
}

View File

@ -1066,9 +1066,9 @@ cfg_array(activation_volume_list_CFG, "volume_list", activation_CFG_SECTION, CFG
" or VG.\n"
" @*\n"
" Selects an LV if a tag defined on the host is also set on the LV\n"
" or VG. See tags/hosttags. If any host tags exist but volume_list\n"
" is not defined, a default single-entry list containing '@*' is\n"
" assumed.\n"
" or VG. See tags/hosttags. If any host tags exist but the volume\n"
" list is not defined, a default single-entry list containing '@*'\n"
" is assumed.\n"
"#\n"
"Example\n"
"volume_list = [ \"vg1\", \"vg2/lvol1\", \"@tag1\", \"@*\" ]\n"
@ -1102,12 +1102,12 @@ cfg_array(activation_auto_activation_volume_list_CFG, "auto_activation_volume_li
" or VG.\n"
" @*\n"
" Selects an LV if a tag defined on the host is also set on the LV\n"
" or VG. See tags/hosttags. If any host tags exist but volume_list\n"
" is not defined, a default single-entry list containing '@*' is\n"
" assumed.\n"
" or VG. See tags/hosttags. If any host tags exist but the volume\n"
" list is not defined, a default single-entry list containing '@*'\n"
" is assumed.\n"
"#\n"
"Example\n"
"volume_list = [ \"vg1\", \"vg2/lvol1\", \"@tag1\", \"@*\" ]\n"
"auto_activation_volume_list = [ \"vg1\", \"vg2/lvol1\", \"@tag1\", \"@*\" ]\n"
"#\n")
cfg_array(activation_read_only_volume_list_CFG, "read_only_volume_list", activation_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(2, 2, 89), NULL, 0, NULL,
@ -1127,12 +1127,12 @@ cfg_array(activation_read_only_volume_list_CFG, "read_only_volume_list", activat
" or VG.\n"
" @*\n"
" Selects an LV if a tag defined on the host is also set on the LV\n"
" or VG. See tags/hosttags. If any host tags exist but volume_list\n"
" is not defined, a default single-entry list containing '@*' is\n"
" assumed.\n"
" or VG. See tags/hosttags. If any host tags exist but the volume\n"
" list is not defined, a default single-entry list containing '@*'\n"
" is assumed.\n"
"#\n"
"Example\n"
"volume_list = [ \"vg1\", \"vg2/lvol1\", \"@tag1\", \"@*\" ]\n"
"read_only_volume_list = [ \"vg1\", \"vg2/lvol1\", \"@tag1\", \"@*\" ]\n"
"#\n")
cfg(activation_mirror_region_size_CFG, "mirror_region_size", activation_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_RAID_REGION_SIZE, vsn(1, 0, 0), NULL, vsn(2, 2, 99),

View File

@ -1579,7 +1579,7 @@ struct alloc_handle {
* Returns log device size in extents, algorithm from kernel code
*/
#define BYTE_SHIFT 3
static uint32_t mirror_log_extents(uint32_t region_size, uint32_t pe_size, uint32_t area_len)
static uint32_t _mirror_log_extents(uint32_t region_size, uint32_t pe_size, uint32_t area_len)
{
size_t area_size, bitset_size, log_size, region_count;
@ -3281,12 +3281,15 @@ static struct alloc_handle *_alloc_init(struct cmd_context *cmd,
} else {
ah->log_area_count = metadata_area_count;
ah->log_len = !metadata_area_count ? 0 :
mirror_log_extents(ah->region_size, extent_size,
(existing_extents + total_extents) / ah->area_multiple);
_mirror_log_extents(ah->region_size, extent_size,
(existing_extents + new_extents) / ah->area_multiple);
}
log_debug("Adjusted allocation request to %" PRIu32 " logical extents. Existing size %" PRIu32 ". New size %" PRIu32 ".",
total_extents, existing_extents, total_extents + existing_extents);
if (ah->log_len)
log_debug("Mirror log of %" PRIu32 " extents of size %" PRIu32 "sectors needed for region size %" PRIu32 ".",
ah->log_len, extent_size, ah->region_size);
if (mirrors || stripes)
total_extents += existing_extents;

View File

@ -3428,6 +3428,18 @@ static int _repair_inconsistent_vg(struct volume_group *vg)
{
unsigned saved_handles_missing_pvs = vg->cmd->handles_missing_pvs;
/* Cannot write foreign VGs, the owner will repair it. */
if (vg->cmd->system_id && strcmp(vg->system_id, vg->cmd->system_id)) {
log_verbose("Skip metadata repair for foreign VG.");
return 0;
}
/* FIXME: do this at higher level where lvmlockd lock can be changed. */
if (is_lockd_type(vg->lock_type)) {
log_verbose("Skip metadata repair for shared VG.");
return 0;
}
vg->cmd->handles_missing_pvs = 1;
if (!vg_write(vg)) {
log_error("Automatic metadata correction failed");
@ -3457,6 +3469,30 @@ static int _wipe_outdated_pvs(struct cmd_context *cmd, struct volume_group *vg,
{
struct pv_list *pvl, *pvl2;
char uuid[64] __attribute__((aligned(8)));
/*
* Cannot write foreign VGs, the owner will repair it.
* Also, if another host is updating its VG, we may read
* the PVs while some are written but not others, making
* some PVs look outdated to us just because we're reading
* the VG while it's only partially written out.
*/
if (cmd->system_id && strcmp(vg->system_id, cmd->system_id)) {
log_verbose("Skip wiping outdated PVs for foreign VG.");
return 0;
}
/*
* FIXME: do this at higher level where lvmlockd lock can be changed.
* Also if we're reading the VG with the --shared option (not using
* lvmlockd), we can see a VG while it's being written by another
* host, same as the foreign VG case.
*/
if (is_lockd_type(vg->lock_type)) {
log_verbose("Skip wiping outdated PVs for shared VG.");
return 0;
}
dm_list_iterate_items(pvl, to_check) {
dm_list_iterate_items(pvl2, &vg->pvs) {
if (pvl->pv->dev == pvl2->pv->dev)

View File

@ -7,6 +7,7 @@
test_description='Test vgs with duplicate vg names'
SKIP_WITH_LVMPOLLD=1
SKIP_WITH_LVMETAD=1
. lib/inittest

View File

@ -41,6 +41,18 @@ vgcreate $vg2 "$dev2"
not vgrename $vg1 $vg2
vgremove $vg1 $vg2
# FIXME: decide how lvmetad should handle
# duplicate VG names. lvmetad now ignores
# the VG on device B if it already knows
# about the same VG name on device A.
# This lets you vgrename the VG on device A
# which allows the VG on device B to reappear
# once it's rescanned.
# It's not yet known how we want lvmetad to
# handle duplicate VG names.
test -e LOCAL_LVMETAD && exit 0
# vgrename duplicate name
vgcreate $vg1 "$dev1"
aux disable_dev "$dev1"