← Back to team overview

cloud-init-dev team mailing list archive

Re: [Merge] ~rjschwei/cloud-init:triggerudev into cloud-init:master

 


Diff comments:

> diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py
> index 0998392..5f6f2d8 100644
> --- a/cloudinit/net/sysconfig.py
> +++ b/cloudinit/net/sysconfig.py
> @@ -696,6 +696,14 @@ class Renderer(renderer.Renderer):
>              if nm_conf_content:
>                  util.write_file(nm_conf_path, nm_conf_content, file_mode)
>          if self.netrules_path:
> +            # When many interfaces are present it can happen that we get here
> +            # before they are all setup. Settle if that is the case.
> +            for iface in network_state.iter_interfaces(
> +                    renderer.filter_by_physical):
> +                path = net.sys_dev_path(str(iface))
> +                if not os.path.exists(path):
> +                    util.udevadm_settle(path, 5)
> +                    break

It is my understanding that "settle" will block until all pending udev events are processed. If we go though the process again in my mind that kind of implies that yet another device was attached after the first settle. In that use case we'd never get out of this loop as there can always be another device.

>              netrules_content = self._render_persistent_net(network_state)
>              netrules_path = util.target_path(target, self.netrules_path)
>              util.write_file(netrules_path, netrules_content, file_mode)


-- 
https://code.launchpad.net/~rjschwei/cloud-init/+git/cloud-init/+merge/363571
Your team cloud-init commiters is requested to review the proposed merge of ~rjschwei/cloud-init:triggerudev into cloud-init:master.


References