machined: add UnregisterMachine method

This is the opposite of RegisterMachine: machined knows that the machine is
"gone", but doesn't do anything on its own. We already had TerminateMachine,
but that would stop the unit, which isn't always wanted.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2019-10-29 10:54:45 +01:00
parent ebc57b89c6
commit ef8ff92e8a
5 changed files with 42 additions and 1 deletions
+4 -1
View File
@@ -449,13 +449,16 @@ int machine_stop(Machine *m) {
int machine_finalize(Machine *m) {
assert(m);
if (m->started)
if (m->started) {
log_struct(LOG_INFO,
"MESSAGE_ID=" SD_MESSAGE_MACHINE_STOP_STR,
"NAME=%s", m->name,
"LEADER="PID_FMT, m->leader,
LOG_MESSAGE("Machine %s terminated.", m->name));
m->stopping = true; /* The machine is supposed to be going away. Don't try to kill it. */
}
machine_unlink(m);
machine_add_to_gc_queue(m);