Add log message about performed action 11/149111/4 accepted/tizen/unified/20170922.065535 submit/tizen/20170919.135738 submit/tizen/20170921.100652
authorKonrad Kuchciak <k.kuchciak@samsung.com>
Mon, 11 Sep 2017 12:16:47 +0000 (14:16 +0200)
committerKonrad Kuchciak <k.kuchciak@samsung.com>
Mon, 18 Sep 2017 08:32:53 +0000 (10:32 +0200)
Change-Id: Ib09bdefcf34590d2fc0e30c63ed9bddc5b302874
Signed-off-by: Konrad Kuchciak <k.kuchciak@samsung.com>
src/action/service_recover.c
src/action/service_restart.c
src/action/system_reboot.c
src/action/system_reboot_to_recovery.c

index e60349556fab00c6b681145263228b30ce064e85..72a5391e95e15a2f1c9d0a42f9b996e061e04fb3 100644 (file)
@@ -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);
index dc14dfe3f67cf4144c9f4c0660e056211caaa192..635d5737fceaae0d133354f1b8b41680fc71b5f0 100644 (file)
@@ -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);
-
index a62b48b9ddd2fa5267912d46fa3a0f5a8790becb..4f65e5c58a97124560365ff1e08aef4b72a7404c 100644 (file)
 #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
index f9e188d1213baf8b8093c1b7b5fef19164f7242d..be7ffde9caa711308d745dddffde98a08191f8af 100644 (file)
@@ -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