← Back to team overview

cloud-init-dev team mailing list archive

Re: [Merge] ~raharper/cloud-init:fix/lp-1766287-detect-unstable-names into cloud-init:master

 


Diff comments:

> diff --git a/cloudinit/net/__init__.py b/cloudinit/net/__init__.py
> index 8005454..d8f7dfa 100644
> --- a/cloudinit/net/__init__.py
> +++ b/cloudinit/net/__init__.py
> @@ -107,6 +107,13 @@ def is_bond(devname):
>      return os.path.exists(sys_dev_path(devname, "bonding"))
>  
>  
> +def is_renamed(devname):
> +    name_assign_type = read_sys_net_safe(devname, 'name_assign_type')
> +    if name_assign_type and name_assign_type == '4':

it feels like we should not cause udevadm settle for a '3'.

$ grep . /sys/class/net/*/name_assign_type
...
/sys/class/net/veth4XBH5E/name_assign_type:3
/sys/class/net/veth5D3OIC/name_assign_type:3
/sys/class/net/mpqemubr0/name_assign_type:3
/sys/class/net/pstart0/name_assign_type:3

that is to show that both veth devices (the "host" side) and bridge devices will have '3'.
do you think there is a reason to udevadm settle if we found those ?

> +        return True
> +    return False
> +
> +
>  def is_vlan(devname):
>      uevent = str(read_sys_net_safe(devname, "uevent"))
>      return 'DEVTYPE=vlan' in uevent.splitlines()
> @@ -180,6 +187,18 @@ def find_fallback_nic(blacklist_drivers=None):
>      if not blacklist_drivers:
>          blacklist_drivers = []
>  
> +    if 'net.ifnames=0' in util.get_cmdline():
> +        LOG.debug('Stable ifnames disabled by net.ifnames=0 in /proc/cmdline')
> +    else:
> +        unstable = [device for device in get_devicelist()
> +                    if device not in ['lo'] and not is_renamed(device)]

might as well just use != here.
device != "lo"

> +        if len(unstable):
> +            LOG.debug('Found unstable nic names: %s; calling udevadm settle',
> +                      unstable)
> +            msg = 'WARK: Waiting for udev events to settle'
> +            util.log_time(LOG.debug, msg, func=util.subp,
> +                          args=[['udevadm', 'settle']])
> +

cloudinit/config/cc_disk_setup.py has 'udevadm_settle'.
might as well move to util and use it.

>      # get list of interfaces that could have connections
>      invalid_interfaces = set(['lo'])
>      potential_interfaces = set([device for device in get_devicelist()


-- 
https://code.launchpad.net/~raharper/cloud-init/+git/cloud-init/+merge/344339
Your team cloud-init commiters is requested to review the proposed merge of ~raharper/cloud-init:fix/lp-1766287-detect-unstable-names into cloud-init:master.


References