summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlasdair G Kergon <agk@redhat.com>2016-08-23 12:16:39 +0100
committerAlasdair G Kergon <agk@redhat.com>2016-08-23 12:16:39 +0100
commitb975532433dcbcc01e3cc0ebe8c6165e2d6470f8 (patch)
tree24c3fadf6bb56f81d66109adc513960bc6d583dd
parent97ee5a1cd326cac4fa5642395d13ebbf13965970 (diff)
downloadlvm2-b975532433dcbcc01e3cc0ebe8c6165e2d6470f8.tar.gz
dmeventd: Simplify replacement unmonitor code.
-rw-r--r--lib/activate/activate.c35
1 files changed, 13 insertions, 22 deletions
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index de5deae66..22e3afaf8 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -1831,52 +1831,43 @@ int monitor_dev_for_events(struct cmd_context *cmd, const struct logical_volume
if (monitor) {
if (monitored)
log_verbose("%s already monitored.", display_lvname(lv));
- else if (seg->segtype->ops->target_monitor_events)
+ else if (seg->segtype->ops->target_monitor_events) {
+ log_verbose("Monitoring %s%s", display_lvname(lv), test_mode() ? " [Test mode: skipping this]" : "");
monitor_fn = seg->segtype->ops->target_monitor_events;
+ }
} else {
if (!monitored)
log_verbose("%s already not monitored.", display_lvname(lv));
- else if (*dso)
+ else if (*dso) {
/*
* Divert unmonitor away from code that depends on the new segment
* type instead of the existing one if it's changing.
*/
+ log_verbose("Not monitoring %s with %s%s", display_lvname(lv), dso, test_mode() ? " [Test mode: skipping this]" : "");
new_unmonitor = 1;
- else if (seg->segtype->ops->target_unmonitor_events)
- monitor_fn = seg->segtype->ops->target_unmonitor_events;
+ }
}
- if (new_unmonitor) {
- log_verbose("Not monitoring %s with %s%s", display_lvname(lv), dso, test_mode() ? " [Test mode: skipping this]" : "");
-
- /* FIXME Test mode should really continue a bit further. */
- if (test_mode())
- return 1;
+ /* FIXME Test mode should really continue a bit further. */
+ if (test_mode())
+ continue;
+ if (new_unmonitor) {
if (!target_register_events(cmd, dso, lv, 0, 0, 0)) {
log_error("%s: segment unmonitoring failed.",
display_lvname(lv));
return 0;
}
-
- } else if (!monitor_fn)
- continue;
- else if (monitor_fn) {
- log_verbose("%sonitoring %s%s", monitor ? "M" : "Not m", display_lvname(lv),
- test_mode() ? " [Test mode: skipping this]" : "");
-
- /* FIXME Test mode should really continue a bit further. */
- if (test_mode())
- continue;
-
+ } else if (monitor_fn) {
/* FIXME specify events */
if (!monitor_fn(seg, 0)) {
log_error("%s: %s segment monitoring function failed.",
display_lvname(lv), seg->segtype->name);
return 0;
}
- }
+ } else
+ continue;
/* Check [un]monitor results */
/* Try a couple times if pending, but not forever... */