1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-05-21 22:50:46 +03:00

mirror: block_on_error only with monitoring

When user configured lvm2 to NOT user monitoring, activated mirror
actually hang upon error and it's quite unusable moment.

So instead Warn those 'brave' non-monitoring users about possible
problem and activation mirror without blocking error handling.

This also makes it a bit simpler for test suite to handle trouble
cases when test is running without  dmeventd.
This commit is contained in:
Zdenek Kabelac 2018-03-29 21:10:58 +02:00
parent 66400d003d
commit 55d83f9f6e
2 changed files with 9 additions and 2 deletions

View File

@ -169,6 +169,7 @@ struct cmd_context {
unsigned activate_component:1; /* command activates component LV */
unsigned process_component_lvs:1; /* command processes also component LVs */
unsigned mirror_warn_printed:1; /* command already printed warning about non-monitored mirrors */
/*
* Filtering.
*/

View File

@ -314,8 +314,14 @@ static int _add_log(struct dm_pool *mem, struct lv_segment *seg,
if (mirror_in_sync() && !(seg->status & PVMOVE))
log_flags |= DM_NOSYNC;
if (_block_on_error_available && !(seg->status & PVMOVE))
log_flags |= DM_BLOCK_ON_ERROR;
if (_block_on_error_available && !(seg->status & PVMOVE)) {
if (dmeventd_monitor_mode() > 0)
log_flags |= DM_BLOCK_ON_ERROR;
else {
log_warn_suppress(seg->lv->vg->cmd->mirror_warn_printed, "WARNING: Mirrors without monitoring will not react on failures.");
seg->lv->vg->cmd->mirror_warn_printed = 1;
}
}
return dm_tree_node_add_mirror_target_log(node, region_size, clustered, log_dlid, area_count, log_flags);
}