Skip to content

fix(e2e): enable persistent journal to capture post-reboot logs#1465

Open
qinqon wants to merge 1 commit intonmstate:mainfrom
qinqon:persistent-journal
Open

fix(e2e): enable persistent journal to capture post-reboot logs#1465
qinqon wants to merge 1 commit intonmstate:mainfrom
qinqon:persistent-journal

Conversation

@qinqon
Copy link
Member

@qinqon qinqon commented Mar 24, 2026

/kind bug

What this PR does / why we need it:

Enables persistent systemd journal on kubevirtci nodes so that logs survive node reboots during e2e tests.

Currently the VMs use volatile journal (/run/log/journal), which means all logs are lost when a test reboots a node. This makes it impossible to debug failures in reboot tests — for example, in build 2036261859606138880 the should keep the default IP address after node reboot test failed because cni0 wasn't recreated after an OVS bridge was removed, but the post-reboot flannel/kubelet logs were not available to diagnose why.

The fix creates /var/log/journal on each node during cluster-up. Since systemd-journald defaults to Storage=auto, this is sufficient to enable persistent storage across reboots.

Special notes for your reviewer:

No functional test changes — this only affects log collection for debugging.

Release note:

NONE

The kubevirtci VMs use volatile journal by default, so logs are lost
when a node reboots during tests. This makes it impossible to debug
failures in reboot tests (e.g. cni0 not recreated after OVS bridge
removal).

Create /var/log/journal on each node during cluster-up so
systemd-journald (Storage=auto) persists logs across reboots.

Signed-off-by: Enrique Llorente <ellorent@redhat.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@kubevirt-bot kubevirt-bot added release-note-none Denotes a PR that doesn't merit a release note. kind/bug labels Mar 24, 2026
@kubevirt-bot kubevirt-bot added the dco-signoff: yes Indicates the PR's author has DCO signed all their commits. label Mar 24, 2026
@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a debugging challenge in e2e tests by ensuring that systemd journal logs persist across node reboots. Previously, logs were lost, making it difficult to diagnose issues in tests that involve node restarts. The change implements a mechanism to retain these crucial logs, thereby enhancing the ability to troubleshoot test failures effectively.

Highlights

  • Persistent Journal: Enabled persistent systemd journal on kubevirtci nodes to retain logs across reboots during e2e tests, improving debuggability for reboot-related failures.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request successfully enables persistent systemd journal on kubevirtci nodes by creating the /var/log/journal directory and restarting the systemd-journald service. This change directly addresses the issue of lost logs after node reboots during e2e tests, significantly improving debugging capabilities. A minor efficiency improvement could be considered for the service restart operation to avoid unnecessary interruptions.

./cluster/cli.sh ssh ${node} -- sudo systemctl restart NetworkManager
# Enable persistent journal so logs survive node reboots
./cluster/cli.sh ssh ${node} -- sudo mkdir -p /var/log/journal
./cluster/cli.sh ssh ${node} -- sudo systemctl restart systemd-journald

Choose a reason for hiding this comment

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

medium

To improve efficiency and avoid unnecessary service interruptions, consider restarting systemd-journald only if it's not already configured for persistent storage. While mkdir -p /var/log/journal ensures the directory exists, systemd-journald might already be running with persistent storage enabled from a previous run. An unconditional restart on every node in the loop could lead to minor performance overhead and temporary logging unavailability. A conditional restart would be more robust.

Suggested change
./cluster/cli.sh ssh ${node} -- sudo systemctl restart systemd-journald
./cluster/cli.sh ssh ${node} -- sudo bash -c 'if ! journalctl --disk-usage | grep -q "Persistent: yes"; then systemctl restart systemd-journald; fi'

Copy link
Member Author

Choose a reason for hiding this comment

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

This runs once during cluster-up on freshly provisioned VMs, so there's no "previous run" scenario — the nodes are always new. The restart takes milliseconds and the script already restarts heavier services (NetworkManager, openvswitch) unconditionally in the same loop. Adding a conditional check would be more complex for no practical benefit here.

@mkowalski
Copy link
Member

/lgtm
/approve

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Mar 24, 2026
@kubevirt-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mkowalski

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubevirt-bot kubevirt-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 24, 2026
@kubevirt-bot
Copy link
Collaborator

@qinqon: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-kubernetes-nmstate-e2e-handler-k8s f933809 link true /test pull-kubernetes-nmstate-e2e-handler-k8s
Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. kind/bug lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants