Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parse-nm: account for veth and dummy when checking for virtual types #513

Merged
merged 1 commit into from
Sep 3, 2024

Conversation

daniloegea
Copy link
Collaborator

@daniloegea daniloegea commented Sep 2, 2024

The new types DUMMY and VETH were added to the types enum after the generic type NM. We it checked if the interfaces was virtual, in order to build the netdef id, it wouldn't consider DUMMY and VETH.

Because of that, when a dummy or veth interface is created via network manager, it's netdef ID would be the connection UUID. For virtual devices we want it to be the interface name.

It works fine with existing interfaces. Network Manager will get the netdef ID from the file name. It was tested by creating a bunch of dummies and veths via nmcli, updating libnetplan and creating new and modifying existing connections.

I created a PPA for oracular with this patch here https://launchpad.net/~danilogondolfo/+archive/ubuntu/netplan.io

Loading this keyfile:

[connection]
id=dummy-dummy0
type=dummy
uuid=dbcdd742-e2f2-4896-a709-e3e4a64c17b0
#Netplan: passthrough setting
interface-name=dummy0

[ipv4]
#Netplan: passthrough override
method=disabled

[ipv6]
#Netplan: passthrough override
method=disabled
#Netplan: passthrough setting
addr-gen-mode=default

[dummy]

[proxy]

Would emit this YAML:

network:
  version: 2
  dummy-devices:
    NM-dbcdd742-e2f2-4896-a709-e3e4a64c17b0:
      renderer: NetworkManager
      networkmanager:
        uuid: "dbcdd742-e2f2-4896-a709-e3e4a64c17b0"
        name: "dummy-dummy0"
        passthrough:
          connection.interface-name: "dummy0"
          ipv4.method: "disabled"
          ipv6.method: "disabled"
          ipv6.addr-gen-mode: "default"
          ipv6.ip6-privacy: "-1"
          dummy._: ""
          proxy._: ""

With this fix it will emit:

network:
  version: 2
  dummy-devices:
    dummy0:
      renderer: NetworkManager
      networkmanager:
        uuid: "dbcdd742-e2f2-4896-a709-e3e4a64c17b0"
        name: "dummy-dummy0"
        passthrough:
          ipv4.method: "disabled"
          ipv6.method: "disabled"
          ipv6.addr-gen-mode: "default"
          ipv6.ip6-privacy: "-1"
          dummy._: ""
          proxy._: ""

Description

Checklist

  • Runs make check successfully.
  • Retains 100% code coverage (make check-coverage).
  • New/changed keys in YAML format are documented.
  • (Optional) Adds example YAML for new feature.
  • (Optional) Closes an open bug in Launchpad.

@daniloegea daniloegea marked this pull request as ready for review September 2, 2024 17:03
Copy link
Collaborator

@slyon slyon left a comment

Choose a reason for hiding this comment

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

Thanks, lgtm!

@daniloegea
Copy link
Collaborator Author

Thanks, I'll just fix a typo in the commit message before merging.

The new types DUMMY and VETH were added to the types enum after the
generic type NM. In order to build the netdef ID, it checked if the
interface was virtual but it wouldn't consider DUMMY and VETH.

Because of that, when these types of interfaces are created via Network
Manager, their netdef IDs will be the connection UUID. For virtual
devices we want it to be the interface name.
@daniloegea daniloegea merged commit c274b3b into canonical:main Sep 3, 2024
16 checks passed
@slyon slyon added the stable Might be merged in a stable branch label Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stable Might be merged in a stable branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants