From 596c596d0926b4c3bc183335b3ce626cc1ac4840 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 9 Jul 2025 09:35:25 +0200 Subject: [PATCH] machined: add a bit more debug logging --- src/machine/machine.c | 5 +++++ src/machine/machined-core.c | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/machine/machine.c b/src/machine/machine.c index 26252ff9cdd..e127ddcb0e9 100644 --- a/src/machine/machine.c +++ b/src/machine/machine.c @@ -33,6 +33,7 @@ #include "path-util.h" #include "process-util.h" #include "serialize.h" +#include "signal-util.h" #include "socket-util.h" #include "special.h" #include "stdio-util.h" @@ -680,6 +681,8 @@ int machine_stop(Machine *m) { assert(m); + log_debug("Stopping machine '%s'.", m->name); + if (!IN_SET(m->class, MACHINE_CONTAINER, MACHINE_VM)) return -EOPNOTSUPP; @@ -813,6 +816,8 @@ MachineState machine_get_state(Machine *s) { int machine_kill(Machine *m, KillWhom whom, int signo) { assert(m); + log_debug("Killing machine '%s' (%s) with signal %s.", m->name, kill_whom_to_string(whom), signal_to_string(signo)); + if (!IN_SET(m->class, MACHINE_VM, MACHINE_CONTAINER)) return -EOPNOTSUPP; diff --git a/src/machine/machined-core.c b/src/machine/machined-core.c index 075ea4a8031..61078d51ec3 100644 --- a/src/machine/machined-core.c +++ b/src/machine/machined-core.c @@ -162,13 +162,16 @@ void manager_gc(Manager *m, bool drop_not_started) { /* First, if we are not closing yet, initiate stopping */ if (machine_may_gc(machine, drop_not_started) && - machine_get_state(machine) != MACHINE_CLOSING) + machine_get_state(machine) != MACHINE_CLOSING) { + log_debug("Stopping machine '%s' due to GC.", machine->name); machine_stop(machine); + } /* Now, the stop probably made this referenced * again, but if it didn't, then it's time to let it * go entirely. */ if (machine_may_gc(machine, drop_not_started)) { + log_debug("Finalizing machine '%s' due to GC.", machine->name); machine_finalize(machine); machine_free(machine); } -- 2.47.3