lvm2/support-drbd-filter.diff

69 lines
2.4 KiB
Diff
Raw Normal View History

This is still very primitive support of drbd in lvm2.
Can we use some /sys information for this ?
Index: LVM2.2.02.39/lib/cache/lvmcache.c
===================================================================
--- LVM2.2.02.39.orig/lib/cache/lvmcache.c 2008-06-27 23:18:31.000000000 +0800
+++ LVM2.2.02.39/lib/cache/lvmcache.c 2009-03-31 12:08:29.000000000 +0800
@@ -1119,6 +1119,13 @@
pvid, dev_name(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 (MAJOR(existing->dev->dev) != md_major() &&
MAJOR(dev->dev) == md_major())
log_very_verbose("Duplicate PV %s on %s - "
@@ -1131,6 +1138,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)))
Index: LVM2.2.02.39/lib/filters/filter.c
===================================================================
--- LVM2.2.02.39.orig/lib/filters/filter.c 2009-03-31 11:48:52.000000000 +0800
+++ LVM2.2.02.39/lib/filters/filter.c 2009-03-31 11:57:38.000000000 +0800
@@ -46,12 +46,20 @@
static int _md_major = -1;
static int _device_mapper_major = -1;
+static int _drbd_major = -1;
int md_major(void)
{
return _md_major;
}
+/* FIXME: Should we consider filter out non-primary
+ drbd resource ?? */
+int drbd_major(void)
+{
+ return _drbd_major;
+}
+
/*
* Devices are only checked for partition tables if their minor number
* is a multiple of the number corresponding to their type below
@@ -208,6 +216,9 @@
if (!strncmp("md", line + i, 2) && isspace(*(line + i + 2)))
_md_major = line_maj;
+ if (!strncmp("drbd", line + i, 4) && isspace(*(line + i + 4)))
+ _drbd_major = line_maj;
+
/* Look for device-mapper device */
/* FIXME Cope with multiple majors */
if (!strncmp("device-mapper", line + i, 13) && isspace(*(line + i + 13)))