summaryrefslogtreecommitdiffstats
path: root/lib/raid/raid.c
diff options
context:
space:
mode:
authorJonathan Earl Brassow <jbrassow@redhat.com>2011-08-11 05:00:20 +0000
committerJonathan Earl Brassow <jbrassow@redhat.com>2011-08-11 05:00:20 +0000
commit3041b72f063a3deaaa76c581405ae5a0fb6193a6 (patch)
tree795bf6e8abd3f905c546ac69aa09fbbd35f1b99d /lib/raid/raid.c
parentff58e019d8dfbd77fe1753d313b5f9fc8b0f8ee2 (diff)
downloadlvm2-3041b72f063a3deaaa76c581405ae5a0fb6193a6.tar.gz
lvm2-3041b72f063a3deaaa76c581405ae5a0fb6193a6.tar.xz
lvm2-3041b72f063a3deaaa76c581405ae5a0fb6193a6.zip
Add dmeventd monitoring for RAID devices.
Diffstat (limited to 'lib/raid/raid.c')
-rw-r--r--lib/raid/raid.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/lib/raid/raid.c b/lib/raid/raid.c
index 0f9d64e0..4454164a 100644
--- a/lib/raid/raid.c
+++ b/lib/raid/raid.c
@@ -25,6 +25,7 @@
#include "activate.h"
#include "metadata.h"
#include "lv_alloc.h"
+#include "defaults.h"
static const char *_raid_name(const struct lv_segment *seg)
{
@@ -261,6 +262,39 @@ static void _raid_destroy(struct segment_type *segtype)
dm_free((void *) segtype);
}
+static const char *_get_raid_dso_path(struct cmd_context *cmd)
+{
+ const char *config_str = find_config_tree_str(cmd, "dmeventd/raid_library",
+ DEFAULT_DMEVENTD_RAID_LIB);
+ return get_monitor_dso_path(cmd, config_str);
+}
+
+static int _raid_target_monitored(struct lv_segment *seg, int *pending)
+{
+ struct cmd_context *cmd = seg->lv->vg->cmd;
+ const char *dso_path = _get_raid_dso_path(cmd);
+
+ return target_registered_with_dmeventd(cmd, dso_path, seg->lv, pending);
+}
+
+static int _raid_set_events(struct lv_segment *seg, int evmask, int set)
+{
+ struct cmd_context *cmd = seg->lv->vg->cmd;
+ const char *dso_path = _get_raid_dso_path(cmd);
+
+ return target_register_events(cmd, dso_path, seg->lv, evmask, set, 0);
+}
+
+static int _raid_target_monitor_events(struct lv_segment *seg, int events)
+{
+ return _raid_set_events(seg, events, 1);
+}
+
+static int _raid_target_unmonitor_events(struct lv_segment *seg, int events)
+{
+ return _raid_set_events(seg, events, 0);
+}
+
static struct segtype_handler _raid_ops = {
.name = _raid_name,
.text_import_area_count = _raid_text_import_area_count,
@@ -272,6 +306,9 @@ static struct segtype_handler _raid_ops = {
.target_present = _raid_target_present,
.modules_needed = _raid_modules_needed,
.destroy = _raid_destroy,
+ .target_monitored = _raid_target_monitored,
+ .target_monitor_events = _raid_target_monitor_events,
+ .target_unmonitor_events = _raid_target_unmonitor_events,
};
static struct segment_type *init_raid_segtype(struct cmd_context *cmd,
@@ -285,6 +322,12 @@ static struct segment_type *init_raid_segtype(struct cmd_context *cmd,
segtype->cmd = cmd;
segtype->flags = SEG_RAID;
+#ifdef DEVMAPPER_SUPPORT
+#ifdef DMEVENTD
+ if (_get_raid_dso_path(cmd))
+ segtype->flags |= SEG_MONITORED;
+#endif
+#endif
segtype->parity_devs = strstr(raid_type, "raid6") ? 2 : 1;
segtype->ops = &_raid_ops;