mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
dmeventd: Simplify replacement unmonitor code.
This commit is contained in:
parent
97ee5a1cd3
commit
b975532433
@ -1831,52 +1831,43 @@ int monitor_dev_for_events(struct cmd_context *cmd, const struct logical_volume
|
|||||||
if (monitor) {
|
if (monitor) {
|
||||||
if (monitored)
|
if (monitored)
|
||||||
log_verbose("%s already monitored.", display_lvname(lv));
|
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;
|
monitor_fn = seg->segtype->ops->target_monitor_events;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!monitored)
|
if (!monitored)
|
||||||
log_verbose("%s already not monitored.", display_lvname(lv));
|
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
|
* Divert unmonitor away from code that depends on the new segment
|
||||||
* type instead of the existing one if it's changing.
|
* 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;
|
new_unmonitor = 1;
|
||||||
else if (seg->segtype->ops->target_unmonitor_events)
|
}
|
||||||
monitor_fn = seg->segtype->ops->target_unmonitor_events;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* FIXME Test mode should really continue a bit further. */
|
||||||
|
if (test_mode())
|
||||||
|
continue;
|
||||||
|
|
||||||
if (new_unmonitor) {
|
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;
|
|
||||||
|
|
||||||
if (!target_register_events(cmd, dso, lv, 0, 0, 0)) {
|
if (!target_register_events(cmd, dso, lv, 0, 0, 0)) {
|
||||||
log_error("%s: segment unmonitoring failed.",
|
log_error("%s: segment unmonitoring failed.",
|
||||||
display_lvname(lv));
|
display_lvname(lv));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
} else if (monitor_fn) {
|
||||||
} 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;
|
|
||||||
|
|
||||||
/* FIXME specify events */
|
/* FIXME specify events */
|
||||||
if (!monitor_fn(seg, 0)) {
|
if (!monitor_fn(seg, 0)) {
|
||||||
log_error("%s: %s segment monitoring function failed.",
|
log_error("%s: %s segment monitoring function failed.",
|
||||||
display_lvname(lv), seg->segtype->name);
|
display_lvname(lv), seg->segtype->name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
|
continue;
|
||||||
|
|
||||||
/* Check [un]monitor results */
|
/* Check [un]monitor results */
|
||||||
/* Try a couple times if pending, but not forever... */
|
/* Try a couple times if pending, but not forever... */
|
||||||
|
Loading…
Reference in New Issue
Block a user