1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Improve duplicate PV handling

Make the processing of duplicate PVs the
same with and without lvmetad.
This commit is contained in:
David Teigland 2015-04-20 14:13:50 -05:00
parent 92607ecfe6
commit 3fc9615d15
2 changed files with 20 additions and 17 deletions

View File

@ -1610,10 +1610,13 @@ struct lvmcache_info *lvmcache_add(struct labeller *labeller, const char *pvid,
//dm_is_dm_major(MAJOR(dev->dev)))
//
else if (!strcmp(pvid_s, existing->dev->pvid)) {
log_error("Found duplicate PV %s: using %s not "
"%s", pvid, dev_name(dev),
dev_name(existing->dev));
log_error("Found duplicate PV %s: using %s not %s",
pvid_s,
dev_name(existing->dev),
dev_name(dev));
strncpy(dev->pvid, pvid_s, sizeof(dev->pvid));
_found_duplicate_pvs = 1;
return NULL;
}
}
if (strcmp(pvid_s, existing->dev->pvid))

28
lib/cache/lvmetad.c vendored
View File

@ -299,20 +299,6 @@ static struct lvmcache_info *_pv_populate_lvmcache(struct cmd_context *cmd,
if (!dev && fallback)
dev = dev_cache_get_by_devt(fallback, cmd->filter);
if (alt_devices)
alt_device = alt_devices->v;
while (alt_device) {
dev_alternate = dev_cache_get_by_devt(alt_device->v.i, cmd->filter);
if (dev_alternate)
log_warn("Found duplicate of PV %s on device %s.",
pvid_txt, dev_name(dev_alternate));
else
log_warn("Duplicate of PV %s exists on unknown device %"PRId64 ":%" PRId64,
pvid_txt, MAJOR(alt_device->v.i), MINOR(alt_device->v.i));
alt_device = alt_device->next;
}
if (!dev) {
log_warn("WARNING: Device for PV %s not found or rejected by a filter.", pvid_txt);
return NULL;
@ -375,6 +361,20 @@ static struct lvmcache_info *_pv_populate_lvmcache(struct cmd_context *cmd,
++i;
} while (da);
if (alt_devices)
alt_device = alt_devices->v;
while (alt_device) {
dev_alternate = dev_cache_get_by_devt(alt_device->v.i, cmd->filter);
if (dev_alternate)
lvmcache_add(fmt->labeller, (const char *)&pvid, dev_alternate,
vgname, (const char *)&vgid, 0);
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;
}
return info;
}