Skip to content

Comments

systemd/network: set predictable alternative ifnames for virtio#38

Merged
pothos merged 2 commits intoflatcar-masterfrom
kai/alternative-persistent-ifnames
Mar 15, 2021
Merged

systemd/network: set predictable alternative ifnames for virtio#38
pothos merged 2 commits intoflatcar-masterfrom
kai/alternative-persistent-ifnames

Conversation

@pothos
Copy link
Member

@pothos pothos commented Mar 12, 2021

  • udev/rules.d: replace 79-net-google-compat.rules hardcoding ens4v1
    With the systemd/udev 247 change of bind/unbind the old rule to set
    ens4v1 as interface name on GCE broke and only eth0 was used now.
    The old name ens4v1 is not even a current predictable name and the
    breakage already appeared on Stable but for compatibility we can
    support this name as alternative interface name instead of
    maintaining the udev rule. For that, add special networkd link
    files for GCE.
  • systemd/network: set predictable alternative ifnames for virtio
    The virtio interfaces use unpredictable names like eth0 which is
    good as long as there is only one interface. In case there are multiple
    interfaces it makes sense to use predictable names at least as
    alternative names as way of referring to them.

Note: Consider to backport this to 2765.

How to use/testing done

Tested with

{ cat /usr/lib64/systemd/network/98-virtio.link; echo "AlternativeNamesPolicy=database onboard slot path"; echo "AlternativeName=ens4v1"; } | sudo tee /etc/systemd/network/98-virtio.link

on QEMU and GCE. The interface name is eth0 and there are two alternative names ensX and enp0sX attached to it (X is 4 for GCE, 3 for QEMU in my case) and the old hardcoded ens4v1 name.

@pothos pothos requested a review from a team March 12, 2021 16:54
pothos added 2 commits March 12, 2021 20:36
The virtio interfaces use unpredictable names like eth0 which is
good as long as there is only one interface. In case there are multiple
interfaces it makes sense to use predictable names at least as
alternative names as way of referring to them.
With the systemd/udev 247 change of bind/unbind the old rule to set
ens4v1 as interface name on GCE broke and only eth0 was used now.
The old name ens4v1 is not even a current predictable name and the
breakage already appeared on Stable but for compatibility we can
support this name as alternative interface name instead of
maintaining the udev rule. For that, add special networkd link
files for GCE.
@pothos pothos force-pushed the kai/alternative-persistent-ifnames branch from 595b30f to 7e56177 Compare March 12, 2021 19:41
Copy link
Contributor

@margamanterola margamanterola left a comment

Choose a reason for hiding this comment

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

LGTM.

I find it weird that we need two files for alternate matching, but I did some digging myself and couldn't find a better way either. Thanks!

@pothos pothos merged commit d9ec124 into flatcar-master Mar 15, 2021
@pothos pothos deleted the kai/alternative-persistent-ifnames branch March 15, 2021 14:47
pothos added a commit to flatcar-archive/coreos-overlay that referenced this pull request Mar 15, 2021
This pulls in
flatcar/init#38
to set predictable network interface names as alternative interface
names for virtio devices, and also add a special hardcoded ens4v1
name for GCE because the special udev rule to rename the device
stopped working after the systemd 247 update.
pothos added a commit that referenced this pull request Mar 15, 2021
systemd/network: set predictable alternative ifnames for virtio
pothos added a commit to flatcar-archive/coreos-overlay that referenced this pull request Mar 15, 2021
…flatcar-2765)

This pulls in
flatcar/init#38
to set predictable network interface names as alternative interface
names for virtio devices, and also add a special hardcoded ens4v1
name for GCE because the special udev rule to rename the device
stopped working after the systemd 247 update.
A branch flatcar-2765 was created in the init repository to backport
only this change.
pothos added a commit to flatcar-archive/coreos-overlay that referenced this pull request Mar 15, 2021
This pulls in
flatcar/init#38
to set predictable network interface names as alternative interface
names for virtio devices, and also add a special hardcoded ens4v1
name for GCE because the special udev rule to rename the device
stopped working after the systemd 247 update.
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.

2 participants