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

Reply via email to