fix(hostagent): ensure VFs are unmanaged by NetworkManager via persistent udev rule#52
Open
tsorya wants to merge 1 commit into
Open
fix(hostagent): ensure VFs are unmanaged by NetworkManager via persistent udev rule#52tsorya wants to merge 1 commit into
tsorya wants to merge 1 commit into
Conversation
…tent udev rule Add EnsureVFsUnmanaged() to the Backend interface so that NM-specific udev rule logic is encapsulated in NetworkManagerBackend while systemd-networkd cleanly no-ops. Key changes: - Move udev rule logic from hostagent/util into netconfig/nm_udev.go - Mount /etc/udev/rules.d from host into hostagent container to persist the rule across reboots (HostPathDirectoryOrCreate) - Skip udevadm reload/trigger when rule file is already up-to-date NetworkManager only evaluates NM_UNMANAGED when a device first appears, so the rule must be present before VFs are created. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
EnsureVFsUnmanaged()to theBackendinterface so NM-specific udev rule logic is encapsulated inNetworkManagerBackendwhile systemd-networkd cleanly no-opshostagent/util/udev.gointonetconfig/nm_udev.go/etc/udev/rules.dfrom the host into the hostagent container (HostPathDirectoryOrCreate) to persist the NM unmanaged rule across rebootsudevadmreload/trigger when the rule file is already up-to-date (idempotency for the 30s reconcile loop)Background
NetworkManager only evaluates
NM_UNMANAGEDwhen a device first appears. The rule must exist in persistent/etc/udev/rules.d/before VFs are created so NM never manages them. Previously the file was written to the container's ephemeral filesystem, invisible to the host.Test plan
nm_udev_test.go): rule written + udevadm triggered on first run, idempotent skip, overwrite on mismatch, mkdir parents, error paths/etc/udev/rules.d/10-nm-unmanaged.ruleson hostunmanagedinnmcli device status