Skip to content

[release-4.21] OCPBUGS-85041: add --copy-network when manual network config is detected#1446

Open
rwsu wants to merge 2 commits into
openshift:release-4.21from
rwsu:OCPBUGS-85041
Open

[release-4.21] OCPBUGS-85041: add --copy-network when manual network config is detected#1446
rwsu wants to merge 2 commits into
openshift:release-4.21from
rwsu:OCPBUGS-85041

Conversation

@rwsu
Copy link
Copy Markdown
Contributor

@rwsu rwsu commented May 5, 2026

This is a manual cherry-pick of #1416

rwsu added 2 commits May 5, 2026 23:16
When the agent receives the install step, check for NetworkManager keyfiles
created by the user during the agent-tui session before constructing the
coreos-installer command. If found, append --copy-network to the installer
args so that network configuration created via the agent-tui persists into
the installed OS.

The next-step-runner runs in a container with --pid=host but without
/etc/NetworkManager/system-connections mounted. The host's NM connections
directory is accessed via /proc/1/root/etc/NetworkManager/system-connections,
which resolves to the host's filesystem when the container shares the host's
PID namespace.

The agent-tui log file (/var/log/agent/agent-tui.log) is used to confirm
the TUI ran on this node (i.e. we are in an ABI workflow). If absent, the
check is skipped entirely to avoid affecting non-ABI workflows. The /var/log
directory is mounted into the next-step-runner container so this path is
accessible directly.

The mtime of the agent log directory (/var/log/agent) is used as the TUI
start time reference. Auto-generated keyfiles (nm-initrd-generator,
pre-network-manager-config.sh for NMState configs) are created before the
agent-tui starts and are excluded by the mtime comparison. User-created
keyfiles via nmtui can only appear at or after the TUI starts. The comparison
uses >= rather than > to handle filesystems with second-level mtime precision.

When NMState static configs are provided via agent-config.yaml,
assisted-service already adds --copy-network via StaticNetworkConfig so
those keyfiles do not need to be detected here. --copy-network is not
added if already present in the installer args set via the API.

Assisted-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Replace directory mtime with birth time (via djherbis/times) for
determining when the agent-tui started. The log directory is created
fresh by ExecStartPre in agent-interactive-console.service on each
agent ISO boot, so its birth time is set exactly once at service
startup and is unaffected by subsequent file creation inside the
directory.

Also fix gofmt import ordering and the test fixture ordering bug
where Chtimes was called before WriteFile (making it a no-op since
WriteFile would bump the directory mtime).

Additional test coverage and log improvements:
- Add unit test for keyfile created after TUI start (tuiStart + 3s)
- Clarify comments to distinguish keyfile mtime from TUI start btime
- Log keyfile mtime when a manually-created keyfile is found

Assisted-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@openshift-ci-robot openshift-ci-robot added jira/severity-critical Referenced Jira bug's severity is critical for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels May 5, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@rwsu: This pull request references Jira Issue OCPBUGS-85041, which is invalid:

  • expected Jira Issue OCPBUGS-85041 to depend on a bug targeting a version in 4.22.0 and in one of the following states: VERIFIED, RELEASE PENDING, CLOSED (ERRATA), CLOSED (CURRENT RELEASE), CLOSED (DONE), CLOSED (DONE-ERRATA), but no dependents were found

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

This is a manual cherry-pick of #1416

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 openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 5, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 405d774b-844f-47bf-a311-fead2fb18a19

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci openshift-ci Bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label May 5, 2026
@openshift-ci openshift-ci Bot requested review from carbonin and romfreiman May 5, 2026 15:27
@rwsu
Copy link
Copy Markdown
Contributor Author

rwsu commented May 5, 2026

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels May 5, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@rwsu: This pull request references Jira Issue OCPBUGS-85041, which is valid. The bug has been moved to the POST state.

7 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.21.z) matches configured target version for branch (4.21.z)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)
  • release note text is set and does not match the template
  • dependent bug Jira Issue OCPBUGS-84129 is in the state Verified, which is one of the valid states (VERIFIED, RELEASE PENDING, CLOSED (ERRATA), CLOSED (CURRENT RELEASE), CLOSED (DONE), CLOSED (DONE-ERRATA))
  • dependent Jira Issue OCPBUGS-84129 targets the "4.22.0" version, which is one of the valid target versions: 4.22.0
  • bug has dependents

Requesting review from QA contact:
/cc @mhanss

Details

In response to this:

/jira refresh

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci Bot requested a review from mhanss May 5, 2026 15:28
@rwsu
Copy link
Copy Markdown
Contributor Author

rwsu commented May 5, 2026

/test e2e-agent-compact-ipv4

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 6, 2026

@rwsu: all tests passed!

Full PR test history. Your PR dashboard.

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.

@rwsu
Copy link
Copy Markdown
Contributor Author

rwsu commented May 6, 2026

/verified by @rwsu

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label May 6, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@rwsu: This PR has been marked as verified by @rwsu.

Details

In response to this:

/verified by @rwsu

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 openshift-eng/jira-lifecycle-plugin repository.

@andfasano
Copy link
Copy Markdown
Contributor

/approve
/ backport-risk-assessed

@sadasu
Copy link
Copy Markdown

sadasu commented May 6, 2026

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label May 6, 2026
@rwsu
Copy link
Copy Markdown
Contributor Author

rwsu commented May 6, 2026

/assign @gamli75

@gamli75
Copy link
Copy Markdown
Contributor

gamli75 commented May 7, 2026

/approve

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 7, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andfasano, gamli75, rwsu

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

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 7, 2026
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. jira/severity-critical Referenced Jira bug's severity is critical for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants