mirror of
https://github.com/clearlinux/rkt.git
synced 2026-08-24 16:57:47 +00:00
stage1: use --link-journal=host instead of try-host
Since we check if we're running systemd before appending --link-journal to systemd-nspawn we can use host instead of try-host. This allows connecting a pod's journal to the host's journal with systemd version <219.
This commit is contained in:
+13
-13
@@ -218,23 +218,23 @@ func getArgsEnv(p *Pod, flavor, systemdVersion string, debug bool) ([]string, []
|
||||
} else {
|
||||
args = append(args, fmt.Sprintf("--register=false"))
|
||||
}
|
||||
|
||||
if util.IsRunningSystemd() {
|
||||
// we write /etc/machine-id here because systemd-nspawn needs it to link
|
||||
// the container's journal to the host
|
||||
mPath := filepath.Join(common.Stage1RootfsPath(p.Root), "etc", "machine-id")
|
||||
mId := strings.Replace(p.UUID.String(), "-", "", -1)
|
||||
|
||||
if err := ioutil.WriteFile(mPath, []byte(mId), 0644); err != nil {
|
||||
log.Fatalf("error writing /etc/machine-id: %v\n", err)
|
||||
}
|
||||
|
||||
args = append(args, "--link-journal=try-host")
|
||||
}
|
||||
default:
|
||||
return nil, nil, fmt.Errorf("unrecognized stage1 flavor: %q", flavor)
|
||||
}
|
||||
|
||||
if util.IsRunningSystemd() {
|
||||
// we write /etc/machine-id here because systemd-nspawn needs it to link
|
||||
// the container's journal to the host
|
||||
mPath := filepath.Join(common.Stage1RootfsPath(p.Root), "etc", "machine-id")
|
||||
mId := strings.Replace(p.UUID.String(), "-", "", -1)
|
||||
|
||||
if err := ioutil.WriteFile(mPath, []byte(mId), 0644); err != nil {
|
||||
log.Fatalf("error writing /etc/machine-id: %v\n", err)
|
||||
}
|
||||
|
||||
args = append(args, "--link-journal=host")
|
||||
}
|
||||
|
||||
if !debug {
|
||||
args = append(args, "--quiet") // silence most nspawn output (log_warning is currently not covered by this)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user