forked from pool/cloud-init
- Update cloud-init-write-routes.patch (bsc#1132692)
+ Properly accumulate all the defined routes for a given network device. Previously only the last defined route was written to the routes file. - Update cloud-init-trigger-udev.patch (bsc#1125950) + Write the udev rules to a different file than the default + Settle udev if not all configured devices are in the device tree to avoid race condition between udev and cloud-init + Fix the order of calls, the SUSE implementation of route config file OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=137
This commit is contained in:
parent
f30a915a55
commit
23723c1216
@ -1,35 +1,36 @@
|
|||||||
--- cloudinit/net/sysconfig.py.orig
|
--- cloudinit/net/sysconfig.py.orig
|
||||||
+++ cloudinit/net/sysconfig.py
|
+++ cloudinit/net/sysconfig.py
|
||||||
@@ -15,6 +15,7 @@ from .network_state import (
|
@@ -8,6 +8,7 @@ import six
|
||||||
is_ipv6_addr, net_prefix_to_ipv4_mask, subnet_is_ipv6)
|
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
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
from . import renderer
|
||||||
+PERS_NET_RULES_DEFAULT = 'etc/udev/rules.d/70-persistent-net.rules'
|
@@ -673,6 +674,14 @@ class Renderer(renderer.Renderer):
|
||||||
|
if nm_conf_content:
|
||||||
|
util.write_file(nm_conf_path, nm_conf_content, file_mode)
|
||||||
def _make_header(sep='#'):
|
if self.netrules_path:
|
||||||
@@ -276,7 +277,7 @@ class Renderer(renderer.Renderer):
|
+ # When many interfaces are present it can happen that we get here
|
||||||
config = {}
|
+ # before they are all setup. Settle if that is the case.
|
||||||
self.sysconf_dir = config.get('sysconf_dir', 'etc/sysconfig')
|
+ for iface in network_state.iter_interfaces(
|
||||||
self.netrules_path = config.get(
|
+ renderer.filter_by_physical):
|
||||||
- 'netrules_path', 'etc/udev/rules.d/70-persistent-net.rules')
|
+ path = net.sys_dev_path(str(iface))
|
||||||
+ 'netrules_path', PERS_NET_RULES_DEFAULT)
|
+ if not os.path.exists(path):
|
||||||
self.dns_path = config.get('dns_path', 'etc/resolv.conf')
|
+ util.udevadm_settle(path, 5)
|
||||||
nm_conf_path = 'etc/NetworkManager/conf.d/99-cloud-init.conf'
|
+ break
|
||||||
self.networkmanager_conf_path = config.get('networkmanager_conf_path',
|
|
||||||
@@ -676,6 +677,15 @@ class Renderer(renderer.Renderer):
|
|
||||||
netrules_content = self._render_persistent_net(network_state)
|
netrules_content = self._render_persistent_net(network_state)
|
||||||
netrules_path = util.target_path(target, self.netrules_path)
|
netrules_path = util.target_path(target, self.netrules_path)
|
||||||
util.write_file(netrules_path, netrules_content, file_mode)
|
util.write_file(netrules_path, netrules_content, file_mode)
|
||||||
+ # Making the assumption that the configured file is in a sane
|
--- cloudinit/distros/opensuse.py.orig
|
||||||
+ # location
|
+++ cloudinit/distros/opensuse.py
|
||||||
+ if (
|
@@ -38,6 +38,8 @@ class Distro(distros.Distro):
|
||||||
+ os.path.basename(PERS_NET_RULES_DEFAULT)
|
'sysconfig': {
|
||||||
+ != os.path.basename(netrules_path)
|
'control': 'etc/sysconfig/network/config',
|
||||||
+ ):
|
'iface_templates': '%(base)s/network/ifcfg-%(name)s',
|
||||||
+ util.subp(
|
+ 'netrules_path': (
|
||||||
+ ['udevadm', 'trigger', '-a ACTION=add', '-a SUBSYSTEM=net']
|
+ 'etc/udev/rules.d/85-persistent-net-cloud-init.rules'),
|
||||||
+ )
|
'route_templates': {
|
||||||
|
'ipv4': '%(base)s/network/ifroute-%(name)s',
|
||||||
sysconfig_path = util.target_path(target, templates.get('control'))
|
'ipv6': '%(base)s/network/ifroute-%(name)s',
|
||||||
# Distros configuring /etc/sysconfig/network as a file e.g. Centos
|
|
||||||
|
@ -22,9 +22,9 @@
|
|||||||
+ for config in device_configs:
|
+ for config in device_configs:
|
||||||
+ if_name = config.get('name')
|
+ if_name = config.get('name')
|
||||||
+ subnets = config.get('subnets', [])
|
+ subnets = config.get('subnets', [])
|
||||||
|
+ config_routes = ''
|
||||||
+ for subnet in subnets:
|
+ for subnet in subnets:
|
||||||
+ routes = subnet.get('routes', [])
|
+ routes = subnet.get('routes', [])
|
||||||
+ config_routes = ''
|
|
||||||
+ for route in routes:
|
+ for route in routes:
|
||||||
+ dest = route.get('network')
|
+ dest = route.get('network')
|
||||||
+ if dest in default_nets:
|
+ if dest in default_nets:
|
||||||
|
@ -1,3 +1,18 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Apr 24 18:37:32 UTC 2019 - Robert Schweikert <rjschwei@suse.com>
|
||||||
|
|
||||||
|
- Update cloud-init-write-routes.patch (bsc#1132692)
|
||||||
|
+ Properly accumulate all the defined routes for a given network device.
|
||||||
|
Previously only the last defined route was written to the routes file.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Sat Mar 30 12:42:27 UTC 2019 - Robert Schweikert <rjschwei@suse.com>
|
||||||
|
|
||||||
|
- Update cloud-init-trigger-udev.patch (bsc#1125950)
|
||||||
|
+ Write the udev rules to a different file than the default
|
||||||
|
+ Settle udev if not all configured devices are in the device tree to
|
||||||
|
avoid race condition between udev and cloud-init
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Feb 22 22:11:20 UTC 2019 - Robert Schweikert <rjschwei@suse.com>
|
Fri Feb 22 22:11:20 UTC 2019 - Robert Schweikert <rjschwei@suse.com>
|
||||||
|
|
||||||
@ -9,7 +24,7 @@ Fri Feb 22 22:11:20 UTC 2019 - Robert Schweikert <rjschwei@suse.com>
|
|||||||
Fri Feb 22 16:20:28 UTC 2019 - Robert Schweikert <rjschwei@suse.com>
|
Fri Feb 22 16:20:28 UTC 2019 - Robert Schweikert <rjschwei@suse.com>
|
||||||
|
|
||||||
- Modify cloud-init-write-routes.patch (bsc#1125992)
|
- Modify cloud-init-write-routes.patch (bsc#1125992)
|
||||||
+ Fix the order of calls, the SUSE imaplementation of route config file
|
+ Fix the order of calls, the SUSE implementation of route config file
|
||||||
writing must clobber the default implementation.
|
writing must clobber the default implementation.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user