ipxe: Allow overriding the network gateway per interface - #16
Open
bensallen wants to merge 2 commits into
Open
Conversation
An interface with vlanparent set, or named following one of the four styles dracut supports, now generates a dracut vlan= argument. The interface name (or interfacename) must match one of the four styles from dracut.cmdline(7): vlan5, vlan0005, eth0.5 or eth0.0005. The DEV_PLUS_VID styles already encode the parent, so vlanparent is only required for the VLAN_PLUS_VID styles. Added interface attribute "neednet" to enable ip= based configuration even when not the bootdev, allowing for multiple interface configuration via Dracut. Each bootfile now names the interface it was generated for as the bootdev instead of relying on primary. An interface with an ip6 is now configured from the network's ipv6 definition. Previously an ipv6-only interface failed with a misleading "missing 'ip'". Dual-stack interfaces emit one ip= per family. Supported by NetworkManager and systemd-networkd, but not dracut's 35network-legacy. Interfaces are now iterated in sorted order to ensure generated bootfiles don't differ between runs. ipxe.py configuration problems now raise BootloaderConfigError, which write_bootloader_scripts logs as a warning before skipping the interface. These were previously caught by a bare except and only logged at debug. The ipxe template context no longer has "ipline" available, moving fully to the new "netargs". Adds tests/test_ipxe.py. This needs tests/conftest.py and tests/conf to set PHOENIX_CONF before phoenix is imported, which also fixes the existing node tests failing on a clean checkout.
An interface takes the gateway and gateway6 of the network it references. Either can now be set on the interface itself, and setting one to an empty string or false leaves that field of ip= empty so dracut adds no default route through the interface. This allows a node to boot from one interface while routing through another. The two families are independent. Previously the gateway came only from networks.yaml, so suppressing it meant removing it from the network entirely, which affected every node on that network and also dropped the dnsmasq option 3 for it.
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.
This PR stacks on #15.
An interface typically takes the gateway or gateway6 of the network it references.
With this change, either gateway setting can now be set on the interface itself, and setting one to an empty string or false leaves that field of ip= empty so dracut adds no default route through the interface. This allows a node to boot from one interface while routing through another.
Previously the gateway came only from networks.yaml, so suppressing the gateway meant removing it from the network entirely.
The use-case where I needed this was a login node that is being provisioned on a cluster network that has a gateway for compute nodes, but the login has a public interface that should be its default gateway.