This is still very primitive support of drbd in lvm2. Can we use some /sys information for this ? --- lib/cache/lvmcache.c | 14 ++++++++++++++ lib/filters/filter.c | 7 +++++++ 2 files changed, 21 insertions(+) --- LVM2.2.02.98.orig/lib/cache/lvmcache.c +++ LVM2.2.02.98/lib/cache/lvmcache.c @@ -1489,6 +1489,14 @@ struct lvmcache_info *lvmcache_add(struc dev_subsystem_name(existing->dev), dev_name(existing->dev)); return NULL; + } else if (MAJOR(existing->dev->dev) == drbd_major() && + MAJOR(dev->dev) != drbd_major()) { + log_very_verbose("Ignoring duplicate PV %s on " + "%s - using drbd %s", + pvid, dev_name(dev), + dev_name(existing->dev)); + return NULL; + } else if (dm_is_dm_major(MAJOR(existing->dev->dev)) && !dm_is_dm_major(MAJOR(dev->dev))) { log_very_verbose("Ignoring duplicate PV %s on " @@ -1509,6 +1517,12 @@ struct lvmcache_info *lvmcache_add(struc "using dm %s", pvid, dev_name(existing->dev), dev_name(dev)); + else if (MAJOR(existing->dev->dev) != drbd_major() && + MAJOR(dev->dev) == drbd_major()) + log_very_verbose("Duplicate PV %s on %s - " + "using drbd %s", pvid, + dev_name(existing->dev), + dev_name(dev)); /* FIXME If both dm, check dependencies */ //else if (dm_is_dm_major(MAJOR(existing->dev->dev)) && //dm_is_dm_major(MAJOR(dev->dev))) --- LVM2.2.02.98.orig/lib/filters/filter.c +++ LVM2.2.02.98/lib/filters/filter.c @@ -60,6 +60,13 @@ int md_major(void) return _md_major; } +/* FIXME: Should we consider filter out non-primary + drbd resource ?? */ +int drbd_major(void) +{ + return _drbd_major; +} + int blkext_major(void) { return _blkext_major;