2019-06-09 13:04:38 +02:00
|
|
|
--- cloudinit/distros/opensuse.py.orig
|
|
|
|
+++ cloudinit/distros/opensuse.py
|
|
|
|
@@ -38,6 +38,8 @@ class Distro(distros.Distro):
|
|
|
|
'sysconfig': {
|
|
|
|
'control': 'etc/sysconfig/network/config',
|
|
|
|
'iface_templates': '%(base)s/network/ifcfg-%(name)s',
|
|
|
|
+ 'netrules_path': (
|
|
|
|
+ 'etc/udev/rules.d/85-persistent-net-cloud-init.rules'),
|
|
|
|
'route_templates': {
|
|
|
|
'ipv4': '%(base)s/network/ifroute-%(name)s',
|
|
|
|
'ipv6': '%(base)s/network/ifroute-%(name)s',
|
2019-02-22 23:18:27 +01:00
|
|
|
--- cloudinit/net/sysconfig.py.orig
|
|
|
|
+++ cloudinit/net/sysconfig.py
|
2019-04-30 22:39:13 +02:00
|
|
|
@@ -8,6 +8,7 @@ import six
|
|
|
|
from cloudinit.distros.parsers import networkmanager_conf
|
|
|
|
from cloudinit.distros.parsers import resolv_conf
|
|
|
|
from cloudinit import log as logging
|
|
|
|
+from cloudinit import net
|
|
|
|
from cloudinit import util
|
2019-02-22 23:18:27 +01:00
|
|
|
|
2019-06-09 13:04:38 +02:00
|
|
|
from configobj import ConfigObj
|
|
|
|
@@ -699,6 +700,14 @@ class Renderer(renderer.Renderer):
|
2019-04-30 22:39:13 +02:00
|
|
|
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):
|
2019-09-23 15:07:29 +02:00
|
|
|
+ path = net.sys_dev_path(iface.get('name'))
|
2019-04-30 22:39:13 +02:00
|
|
|
+ if not os.path.exists(path):
|
|
|
|
+ util.udevadm_settle(path, 5)
|
|
|
|
+ break
|
2019-02-22 23:18:27 +01:00
|
|
|
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)
|