Split generate/configure stages for sd-generator compliance#552
Merged
slyon merged 44 commits intocanonical:mainfrom Dec 16, 2025
Merged
Split generate/configure stages for sd-generator compliance#552slyon merged 44 commits intocanonical:mainfrom
slyon merged 44 commits intocanonical:mainfrom
Conversation
5 tasks
8287a28 to
9105838
Compare
15db9ad to
320629c
Compare
Contributor
Author
Packaging TODOs
|
320629c to
4f36a61
Compare
b507c0d to
d2bd8a8
Compare
869fc6e to
1ee0b9f
Compare
42d4420 to
14a12f9
Compare
14a12f9 to
c1cd723
Compare
1fbbcc2 to
5c7c78c
Compare
Contributor
Author
|
rebased to resolve conflicts against #563 |
5c7c78c to
b05807e
Compare
5 tasks
e1affde to
428cdee
Compare
Contributor
Author
|
I did a bunch of testing in https://bugs.launchpad.net/ubuntu/+source/netplan.io/+bug/2133724 which led to some tweaks around udev dependencies in |
…rator and network-configurator This is to make them fail under the same circumstances, e.g. do not generate systemd units corresponding to network interfaces that we cannot write any network configuration files for, due to some late-stage validation error. Adding new (internal, for now) _netplan_state_get/set_flags() API. This is enabled by passing a new NETPLAN_STATE_VALIDATION_ONLY flag to NetplanState, to skip writing out files. - The sd-generator (./generate) should not write any network configuration, but still needs to run through its late-stage validations, to fail if the network-configuration would fail. - The network-configuration should not write any systemd units, but still needs to run trhough its late-stage validations, in order to fail if the sd-generator would fail. Future improvement: Ideally, there should not be any late-stage validation inside file writing logic (e.g. [gen-]networkd.c, [gen-]openvswitch.c, ...), but all validation should already be done in the central validation.c stage. Unfortunately, such change is out of scope for this PR.
…r integration during 'netplan try'
…#2090848) This avoids conflicts with AppArmor confinement when re-generating the network configuration from within NetworkManager.
See original PR: canonical#162
It introduces unrelated failures and wastes resources, as we're not currently affected by an ABI breaking change.
…nerator This was originally implemented to generate & start systemd units just-in-time during the boot transaction (canonical#162). With the implementation of a proper systemd-generator, Netplan generates the corresponding units in /run/system/generator* and automatically re-loads and re-calculates dependencies during "daemon-reload". Therefore, we do not need to inject them manually. This is covered by the "cloud-init" autopkgtest.
sbuild does not provide a fully functional systemd environment, as indicated by the existance of /run/systemd/system. Therefore, we cannot rely on the systemd-run sandbox in such environments.
428cdee to
636f8cc
Compare
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.
Description
Refactor Netplan's
generatebinary to be a proper systemd.generator, according to spec "FO165 – Netplan generator architecture".New testing of a simulated systemd sandbox is implemented in
tests/generator/test_sd-generator.py..serviceunits oroverride.confdrop-in configs) is now generated insrc/gen-*.cand run duringdaemon-reload.src/{networkd,nm,sriov,openvswitch}.c.TestSystemdGenerator.test_sandbox), that make sure theusr/libexec/netplan/generatebinary does not write files outside the allowed scope for a systemd-generator.--networkmanager-onlyparameter, to improve NM integration, by not touching any systemd[-networkd] files_netplan_state_get/set_flags()API (internal, for now) to do "validation-only" runs over our NetDef dataChecklist
make checksuccessfully.make check-coverage).This should also fix https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/2083129 by not re-generating NM configuration on the fly. And https://bugs.launchpad.net/ubuntu/+source/netplan.io/+bug/2090848 by using the new
/usr/libexec/netplan/configure --networkmanager-onlyflag.