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:
parent
92607ecfe6
commit
3fc9615d15
9
lib/cache/lvmcache.c
vendored
9
lib/cache/lvmcache.c
vendored
@ -1610,10 +1610,13 @@ struct lvmcache_info *lvmcache_add(struct labeller *labeller, const char *pvid,
|
|||||||
//dm_is_dm_major(MAJOR(dev->dev)))
|
//dm_is_dm_major(MAJOR(dev->dev)))
|
||||||
//
|
//
|
||||||
else if (!strcmp(pvid_s, existing->dev->pvid)) {
|
else if (!strcmp(pvid_s, existing->dev->pvid)) {
|
||||||
log_error("Found duplicate PV %s: using %s not "
|
log_error("Found duplicate PV %s: using %s not %s",
|
||||||
"%s", pvid, dev_name(dev),
|
pvid_s,
|
||||||
dev_name(existing->dev));
|
dev_name(existing->dev),
|
||||||
|
dev_name(dev));
|
||||||
|
strncpy(dev->pvid, pvid_s, sizeof(dev->pvid));
|
||||||
_found_duplicate_pvs = 1;
|
_found_duplicate_pvs = 1;
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (strcmp(pvid_s, existing->dev->pvid))
|
if (strcmp(pvid_s, existing->dev->pvid))
|
||||||
|
28
lib/cache/lvmetad.c
vendored
28
lib/cache/lvmetad.c
vendored
@ -299,20 +299,6 @@ static struct lvmcache_info *_pv_populate_lvmcache(struct cmd_context *cmd,
|
|||||||
if (!dev && fallback)
|
if (!dev && fallback)
|
||||||
dev = dev_cache_get_by_devt(fallback, cmd->filter);
|
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) {
|
if (!dev) {
|
||||||
log_warn("WARNING: Device for PV %s not found or rejected by a filter.", pvid_txt);
|
log_warn("WARNING: Device for PV %s not found or rejected by a filter.", pvid_txt);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -375,6 +361,20 @@ static struct lvmcache_info *_pv_populate_lvmcache(struct cmd_context *cmd,
|
|||||||
++i;
|
++i;
|
||||||
} while (da);
|
} 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;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user