diff --git a/src/machine/machine.c b/src/machine/machine.c index 26252ff9cd..e127ddcb0e 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 075ea4a803..61078d51ec 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); }