Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Feb 24, 2020. It is now read-only.

Conversation

@iaguis
Copy link
Member

@iaguis iaguis commented Mar 16, 2016

In the nspawn flavors, we use the "--try-guest" option. This means a
symlink is created from /var/log/journal/${machine-id} to pod's
/var/log/journal/{machine-id} when the pod is started.

If that symlink exists when doing GC, remove it.

If systemd on the host is configured to use /run/log/journal/, we
don't care about that because it will be deleted on a reboot.

Fixes #2281

stage1/gc/gc.go Outdated
func removeJournalLink(uuid *types.UUID) error {
machineID := strings.Replace(uuid.String(), "-", "", -1)
journalLink := filepath.Join("/var/log/journal", machineID)
_, err := os.Lstat(journalLink)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

os.Remove(), and if err == enoexist, err = nil

save a syscall, save a tree

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok :)

In the nspawn flavors, we use the "--try-guest" option. This means a
symlink is created from `/var/log/journal/${machine-id}` to pod's
`/var/log/journal/{machine-id}` when the pod is started.

If that symlink exists when doing GC, remove it.

If systemd on the host is configured to use `/run/log/journal/`, we
don't care about that because it will be deleted on a reboot.
@iaguis iaguis force-pushed the iaguis/gc-journal branch from 287ee91 to 0c098b9 Compare March 16, 2016 17:05
@iaguis
Copy link
Member Author

iaguis commented Mar 16, 2016

Updated.

@alban
Copy link
Member

alban commented Mar 17, 2016

LGTM

iaguis added a commit that referenced this pull request Mar 17, 2016
@iaguis iaguis merged commit be35659 into rkt:master Mar 17, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants