From: Konrad Kuchciak Date: Mon, 11 Sep 2017 12:16:47 +0000 (+0200) Subject: Add log message about performed action X-Git-Tag: submit/tizen/20170919.135738^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4e6e63f3461bfe43b9e7b4be29b4d7488fb28181;p=platform%2Fcore%2Fsystem%2Ffaultd.git Add log message about performed action Change-Id: Ib09bdefcf34590d2fc0e30c63ed9bddc5b302874 Signed-off-by: Konrad Kuchciak --- diff --git a/src/action/service_recover.c b/src/action/service_recover.c index e603495..72a5391 100644 --- a/src/action/service_recover.c +++ b/src/action/service_recover.c @@ -48,6 +48,8 @@ static int recover_service(struct faultd_action *action) "replace"); if (ret < 0) log_error_errno(ret, "Failed to restart service: %s", service_path); + else + log_kmsg("Recovering service: %s", service_path); unref_old_event: faultd_event_unref(ev); diff --git a/src/action/service_restart.c b/src/action/service_restart.c index dc14dfe..635d573 100644 --- a/src/action/service_restart.c +++ b/src/action/service_restart.c @@ -43,6 +43,8 @@ static int restart_service(struct faultd_action *action) "replace"); if (ret < 0) log_error_errno(ret, "Failed to restart service: %s", service_path); + else + log_kmsg("Restarting service: %s", service_path); unref_old_event: faultd_event_unref(ev); @@ -57,4 +59,3 @@ static struct faultd_action service_restart_action = { }; FAULTD_ACTION_REGISTER_SIMPLE(service_restart_action); - diff --git a/src/action/system_reboot.c b/src/action/system_reboot.c index a62b48b..4f65e5c 100644 --- a/src/action/system_reboot.c +++ b/src/action/system_reboot.c @@ -19,14 +19,37 @@ #include "action.h" #include "action_executor.h" #include "decision_made_event.h" +#include "service_failed_event.h" +#include "resource_violation_event.h" #include "log.h" #include "systemd_dbus.h" static int reboot_system(struct faultd_action *action) { struct faultd_event *ev = pop_faultd_event(&action->execution_queue); + struct decision_made_event *dm_ev = to_decision_made_event(ev); + struct service_failed_event *sf_ev = NULL; + struct resource_violation_event *rv_ev = NULL; int ret; + if (faultd_event_is_of_type(dm_ev->reason, + SERVICE_FAILED_EVENT_ID)) { + + sf_ev = to_service_failed_event(dm_ev->reason); + log_kmsg("Trying to reboot the system (reason: %s)", + sf_ev->service.dbus_path); + + } else if (faultd_event_is_of_type(dm_ev->reason, + RESOURCE_VIOLATION_EVENT_ID)) { + + rv_ev = to_resource_violation_event(dm_ev->reason); + log_kmsg("Trying to reboot the system (reason: %s)", + rv_ev->service.dbus_path); + + } else { + log_kmsg("Trying to reboot the system"); + } + /* * We reboot the system without using logind because this action may be * executed when for example dbus daemon is dead diff --git a/src/action/system_reboot_to_recovery.c b/src/action/system_reboot_to_recovery.c index f9e188d..be7ffde 100644 --- a/src/action/system_reboot_to_recovery.c +++ b/src/action/system_reboot_to_recovery.c @@ -53,6 +53,7 @@ static int reboot_system_to_recovery(struct faultd_action *action) log_error("Unable to set reboot param"); reboot: + log_kmsg("Trying to reboot to recovery"); /* * We reboot the system without using logind because this action may be * executed when for example dbus daemon is dead