Skip to content

B #411: Preserve NetworkManager connection profiles and support ETHx_ZONE - #412

Open
trukhinyuri wants to merge 1 commit into
OpenNebula:masterfrom
trukhinyuri:fix/nm-preserve-firewalld-zone
Open

trukhinyuri wants to merge 1 commit into
OpenNebula:masterfrom
trukhinyuri:fix/nm-preserve-firewalld-zone

Conversation

@trukhinyuri

@trukhinyuri trukhinyuri commented Oct 14, 2026 •

Copy link
Copy Markdown

Description

Fixes #411.

  • In context-linux/src/etc/one-context.d/loc-10-network.d/functions, skip deleting /etc/sysconfig/network-scripts/ifcfg-${_dev} and /etc/NetworkManager/system-connections/*, and skip calling nm_disable when ${_cfgtype} is nm. This allows netcfg-nm (nm_connection_exist) to update existing NetworkManager connection profiles in place across reboots instead of recreating them from scratch and resetting connection.zone.
  • In context-linux/src/etc/one-context.d/loc-10-network.d/netcfg-nm, update nm_connection_exist to match existing profiles by connection.interface-name, rename a single non-matching connection.id (e.g. System eth0) to ${dev} so its connection.zone is preserved, and remove any duplicate profiles for the same interface.
  • Export zone=$(get_iface_var "$1" "ZONE") in setup_iface_vars and apply nmcli con mod "${dev}" connection.zone "${zone}" in netcfg-nm when ETHx_ZONE is provided in the VM context.

Branches to which this PR applies

  • master
  • one-7.0

Copilot AI balanced review requested due to automatic review settings October 14, 2026 16:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Existing profiles whose connection ID differs from the device name may be retained but ignored in favor of a new competing profile.

1 open finding
What changed in this PR

Preserves NetworkManager profiles during contextualization and adds declarative firewalld zone configuration.

Changes:

  • Skips NetworkManager profile deletion and disabling for NETCFG_TYPE=nm.
  • Adds ETHx_ZONE support via connection.zone.
File Description
netcfg-nm Applies the interface’s configured zone.
functions Preserves NM profiles and reads ETHx_ZONE.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

…port ETHx_ZONE

Do not delete existing NetworkManager connection profiles or call nm_disable
during the local stage in initialize_network when _cfgtype is nm, so
netcfg-nm updates existing profiles in place across reboots and preserves
properties such as connection.zone. In nm_connection_exist, match existing
connections by connection.interface-name, rename a single non-matching
connection ID to the target interface name, and delete duplicate profiles.
Also support ETHx_ZONE in setup_iface_vars and apply connection.zone in
netcfg-nm when specified.

Signed-off-by: Iurii Trukhin <yuri@trukhin.com>
@trukhinyuri
trukhinyuri force-pushed the fix/nm-preserve-firewalld-zone branch from 3395712 to 4f09ac2 Compare October 14, 2026 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

context-linux: initialize_network deletes NetworkManager connection profiles on boot, resetting firewalld zone

2 participants