This is still very primitive support of drbd in lvm2. Can we use some /sys information for this ? Index: LVM2.2.02.58/lib/cache/lvmcache.c ================================================================================ --- LVM2.2.02.58/lib/cache/lvmcache.c +++ LVM2.2.02.58/lib/cache/lvmcache.c @@ -1222,6 +1222,14 @@ 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 " @@ -1242,6 +1250,12 @@ "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.58/lib/filters/filter.c +++ LVM2.2.02.58/lib/filters/filter.c @@ -54,6 +54,13 @@ 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;