Skip to content

Commit

Permalink
mantle/platform/qemu: Adjust dependencies on journal-stream unit
Browse files Browse the repository at this point in the history
The unit kept getting killed when entering emergency.target, which
isn't very useful since some of the messages that hadn't been flushed
yet were the ones that revealed the root cause of the failure. Let's
set up the ordering/deps such that it doesn't get taken down when
entering emergency.target.

Also add a sleep 1 in the Destroy to allow for some remaining messages
to get flushed.
  • Loading branch information
dustymabe committed May 7, 2024
1 parent 13873a0 commit 862c4a0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions mantle/platform/qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@ func (inst *QemuInstance) Destroy() {
os.Remove(inst.qmpSocketPath) //nolint // Ignore Errors
}
if inst.journalPipe != nil {
plog.Debugf("Sleep 1 to allow for more journal messages to get flushed")
time.Sleep(1 * time.Second)
inst.journalPipe.Close()
inst.journalPipe = nil
}
Expand Down Expand Up @@ -1629,6 +1631,15 @@ func (builder *QemuBuilder) VirtioJournal(config *conf.Conf, queryArguments stri
var streamJournalUnit = fmt.Sprintf(`[Unit]
Requires=dev-virtio\\x2dports-mantlejournal.device
IgnoreOnIsolate=true
# DefaultDependencies=false so that Requires=sysinit.target
# won't be added to this unit, which would cause it to get
# taken down when isolating to emergency.target
DefaultDependencies=no
After=systemd.journal.service
# After systemd-journal-flush because otherwise the journalctl -f
# below will stop when the journal is flushed. Not sure if this is
# a bug or intended behavior.
After=systemd-journal-flush.service
[Service]
Type=simple
StandardOutput=file:/dev/virtio-ports/mantlejournal
Expand Down

0 comments on commit 862c4a0

Please sign in to comment.