mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
dmeventd: provide message context
Show device name with printed message. Also use different level for printing error message and standard informational message.
This commit is contained in:
parent
4e26024add
commit
a9ee86ccf2
@ -99,20 +99,21 @@ static int _get_mirror_event(struct dso_state *state, char *params)
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _remove_failed_devices(const char *cmd_lvscan, const char *cmd_lvconvert)
|
static int _remove_failed_devices(const char *cmd_lvscan, const char *cmd_lvconvert,
|
||||||
|
const char *device)
|
||||||
{
|
{
|
||||||
int r;
|
|
||||||
|
|
||||||
if (!dmeventd_lvm2_run_with_lock(cmd_lvscan))
|
if (!dmeventd_lvm2_run_with_lock(cmd_lvscan))
|
||||||
log_warn("WARNING: Re-scan of mirrored device failed.");
|
log_warn("WARNING: Re-scan of mirrored device %s failed.", device);
|
||||||
|
|
||||||
/* if repair goes OK, report success even if lvscan has failed */
|
/* if repair goes OK, report success even if lvscan has failed */
|
||||||
r = dmeventd_lvm2_run_with_lock(cmd_lvconvert);
|
if (!dmeventd_lvm2_run_with_lock(cmd_lvconvert)) {
|
||||||
|
log_error("Repair of mirrored device %s failed.", device);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
log_info("Repair of mirrored device %s.",
|
log_info("Repair of mirrored device %s finished successfully.", device);
|
||||||
(r) ? "finished successfully" : "failed");
|
|
||||||
|
|
||||||
return r;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void process_event(struct dm_task *dmt,
|
void process_event(struct dm_task *dmt,
|
||||||
@ -151,7 +152,8 @@ void process_event(struct dm_task *dmt,
|
|||||||
case ME_FAILURE:
|
case ME_FAILURE:
|
||||||
log_error("Device failure in %s.", device);
|
log_error("Device failure in %s.", device);
|
||||||
if (!_remove_failed_devices(state->cmd_lvscan,
|
if (!_remove_failed_devices(state->cmd_lvscan,
|
||||||
state->cmd_lvconvert))
|
state->cmd_lvconvert,
|
||||||
|
device))
|
||||||
/* FIXME Why are all the error return codes unused? Get rid of them? */
|
/* FIXME Why are all the error return codes unused? Get rid of them? */
|
||||||
log_error("Failed to remove faulty devices in %s.",
|
log_error("Failed to remove faulty devices in %s.",
|
||||||
device);
|
device);
|
||||||
|
Loading…
Reference in New Issue
Block a user