lvm2/support-drbd-filter.diff
Stephan Kulow f1a960eb91 Accepting request 138672 from Base:System
- lvm2.spec: merge rules for device-mapper and
  lvm2-clvm packages, so there is only one
  spec file and all packages are built consistently.

OBS-URL: https://build.opensuse.org/request/show/138672
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/lvm2?expand=0&rev=47
2012-10-23 17:40:13 +00:00

54 lines
1.7 KiB
Diff

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;