Code review comment for ~slyon/snappy-hwe-snaps/+git/network-manager:slyon/drop-vendorized-netplan

Revision history for this message
Lukas Märdian (slyon) wrote :

From my understanding of the code in `nms-keyfile-utils.c -> generate_netplan()` if the .Generate() DBus API would not be available on an older version of core20, NM would still be able to successfully produce new YAML (or modify existing YAML) in /etc/netplan but would then fail to generate the corresponding keyfile data out of that. So the NM state would basically not be updated, but the old configuration still in place. After a reboot (or 'netplan apply' call from the outside system) the current state would be visible to NM.

I don't have access to older versions of core20 (that would not provide the .Generate() API), so I could not test it in the real environment, but tested it inside a normal ("classic") Ubuntu Focal installation, where the modified NetworkManager is installed; that confirmed my assumption from above:

# nmcli con add type ethernet
[...]
Error: Failed to add 'ethernet' connection: failure adding connection: settings plugin does not support adding connections

# nmcli con mod ethernet con-name abc
[...]
Error: Failed to modify connection 'abc': failed to update connection: keyfile writer produces an invalid connection: cannot access file: No such file or directory

# nmcli con reload
Call failed: Unknown method Generate or interface io.netplan.Netplan.
Traceback (most recent call last):
  File "/usr/sbin/netplan", line 23, in <module>
    netplan.main()
  File "/usr/share/netplan/netplan/cli/core.py", line 50, in main
    self.run_command()
  File "/usr/share/netplan/netplan/cli/utils.py", line 310, in run_command
    self.func()
  File "/usr/share/netplan/netplan/cli/commands/generate.py", line 46, in run
    self.run_command()
  File "/usr/share/netplan/netplan/cli/utils.py", line 310, in run_command
    self.func()
  File "/usr/share/netplan/netplan/cli/commands/generate.py", line 73, in command_generate
    raise RuntimeError(
RuntimeError: failed to communicate with dbus service: error 1

All operations display a similar error message as the "nmcli con reload" command: "Call failed: Unknown method Generate or interface io.netplan.Netplan" / "RuntimeError: failed to communicate with dbus service: error 1"

Deleting of connection profiles via NM even works (but also prints the error message about the missing DBus API):
# nmcli con del abc
[...]
Connection 'abc' (6d8d8b90-5874-458f-b6c9-e1857f3e7b06) successfully deleted.

NetworkManager keeps running at all times (does not crash) and handles the latest configuration after reboot or 'netplan apply' was executed from the outside system. I'd say this qualifies for "NM does not fail catastrophically" and we should be good to go.

« Back to merge proposal