• Bug#1102657: cloud-init - Ec2 instructs netplan to change interface nam

    From Bastian Blank@21:1/5 to All on Fri Apr 11 16:10:01 2025
    Package: cloud-init
    Version: 25.1.1-1
    Severity: important
    X-Debbugs-Cc: bastian.blank@credativ.de

    The Ec2 and Azure datasources generate netplan config with "set-name".
    Ec2 uses the same name that udev already set, Azure generates a new
    "ethX". This instructs netplan to forcibly change the name, even if
    there is a link unit with some other definition.

    This "set-name" needs to go in those case.

    Bastian

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Noah Meyerhans@21:1/5 to Bastian Blank on Tue Apr 22 23:10:01 2025
    On Fri, Apr 11, 2025 at 04:07:28PM +0200, Bastian Blank wrote:
    The Ec2 and Azure datasources generate netplan config with "set-name".
    Ec2 uses the same name that udev already set, Azure generates a new
    "ethX". This instructs netplan to forcibly change the name, even if
    there is a link unit with some other definition.

    This "set-name" needs to go in those case.

    This all seems to be hardcoded:

    if if_type == "physical":
    # required_keys = ['name', 'mac_address']
    eth = {
    "set-name": ifname,
    "match": ifcfg.get("match", None),
    }
    if eth["match"] is None:
    macaddr = ifcfg.get("mac_address", None)
    if macaddr is not None:
    eth["match"] = {"macaddress": macaddr.lower()}
    else:
    del eth["match"]
    del eth["set-name"]
    _extract_addresses(ifcfg, eth, ifname, self.features)
    ethernets.update({ifname: eth})

    See https://github.com/canonical/cloud-init/blob/7a0265d36e01e649f72005548f17dca9ac0150ad/cloudinit/net/netplan.py#L433-L448

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)