SHA256
1
0
forked from pool/cloud-init

Accepting request 678302 from Cloud:Tools

- Add cloud-init-trigger-udev.patch (bsc#1125950)
  + When the user configures a new rules file for network devices
    the rules may not apply immediately, trigger udevadm

- Modify cloud-init-write-routes.patch (bsc#1125992)
  + Fix the order of calls, the SUSE imaplementation of route config file
    writing must clobber the default implementation.

- Add cloud-init-proper-ipv6-varname.patch (bsc#1126101)
  + Use the proper name to designate IPv6 addresses in ifcfg-* files

OBS-URL: https://build.opensuse.org/request/show/678302
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/cloud-init?expand=0&rev=57
This commit is contained in:
Stephan Kulow 2019-02-28 20:24:27 +00:00 committed by Git OBS Bridge
commit 40dff8d618
5 changed files with 180 additions and 5 deletions

View File

@ -0,0 +1,112 @@
--- cloudinit/net/sysconfig.py.orig
+++ cloudinit/net/sysconfig.py
@@ -369,10 +369,13 @@ class Renderer(renderer.Renderer):
ipv6_cidr = "%s/%s" % (subnet['address'], subnet['prefix'])
if ipv6_index == 0:
iface_cfg['IPV6ADDR'] = ipv6_cidr
+ iface_cfg['IPADDR6'] = ipv6_cidr
elif ipv6_index == 1:
iface_cfg['IPV6ADDR_SECONDARIES'] = ipv6_cidr
+ iface_cfg['IPADDR6_0'] = ipv6_cidr
else:
iface_cfg['IPV6ADDR_SECONDARIES'] += " " + ipv6_cidr
+ iface_cfg['IPADDR6_%d' % ipv6_index] = ipv6_cidr
else:
ipv4_index = ipv4_index + 1
suff = "" if ipv4_index == 0 else str(ipv4_index)
--- tests/unittests/test_distros/test_netconfig.py.orig
+++ tests/unittests/test_distros/test_netconfig.py
@@ -496,6 +496,7 @@ class TestNetCfgDistroRedhat(TestNetCfgD
BOOTPROTO=none
DEFROUTE=yes
DEVICE=eth0
+ IPADDR6=2607:f0d0:1002:0011::2/64
IPV6ADDR=2607:f0d0:1002:0011::2/64
IPV6INIT=yes
IPV6_DEFAULTGW=2607:f0d0:1002:0011::1
@@ -588,6 +589,7 @@ class TestNetCfgDistroOpensuse(TestNetCf
BOOTPROTO=none
DEFROUTE=yes
DEVICE=eth0
+ IPADDR6=2607:f0d0:1002:0011::2/64
IPV6ADDR=2607:f0d0:1002:0011::2/64
IPV6INIT=yes
IPV6_DEFAULTGW=2607:f0d0:1002:0011::1
--- tests/unittests/test_net.py.orig
+++ tests/unittests/test_net.py
@@ -369,6 +369,9 @@ DEVICE=eth0
GATEWAY=172.19.3.254
HWADDR=fa:16:3e:ed:9a:59
IPADDR=172.19.1.34
+IPADDR6=2001:DB8::10/64
+IPADDR6_0=2001:DB9::10/64
+IPADDR6_2=2001:DB10::10/64
IPV6ADDR=2001:DB8::10/64
IPV6ADDR_SECONDARIES="2001:DB9::10/64 2001:DB10::10/64"
IPV6INIT=yes
@@ -407,6 +410,9 @@ DEVICE=eth0
GATEWAY=172.19.3.254
HWADDR=fa:16:3e:ed:9a:59
IPADDR=172.19.1.34
+IPADDR6=2001:DB8::10/64
+IPADDR6_0=2001:DB9::10/64
+IPADDR6_2=2001:DB10::10/64
IPV6ADDR=2001:DB8::10/64
IPV6ADDR_SECONDARIES="2001:DB9::10/64 2001:DB10::10/64"
IPV6INIT=yes
@@ -658,6 +664,7 @@ NETWORK_CONFIGS = {
BOOTPROTO=none
DEVICE=iface0
IPADDR=192.168.14.2
+ IPADDR6=2001:1::1/64
IPV6ADDR=2001:1::1/64
IPV6INIT=yes
NETMASK=255.255.255.0
@@ -927,6 +934,7 @@ pre-down route del -net 10.0.0.0 netmask
DEFROUTE=yes
DEVICE=br0
IPADDR=192.168.14.2
+ IPADDR6=2001:1::1/64
IPV6ADDR=2001:1::1/64
IPV6INIT=yes
IPV6_DEFAULTGW=2001:4800:78ff:1b::1
@@ -1322,6 +1330,7 @@ pre-down route del -net 10.0.0.0 netmask
MACADDR=aa:bb:cc:dd:e8:ff
IPADDR=192.168.0.2
IPADDR1=192.168.1.2
+ IPADDR6=2001:1::1/92
IPV6ADDR=2001:1::1/92
IPV6INIT=yes
MTU=9000
@@ -1377,6 +1386,7 @@ pre-down route del -net 10.0.0.0 netmask
MACADDR=aa:bb:cc:dd:e8:ff
IPADDR=192.168.0.2
IPADDR1=192.168.1.2
+ IPADDR6=2001:1::1/92
IPV6ADDR=2001:1::1/92
IPV6INIT=yes
MTU=9000
@@ -1467,6 +1477,7 @@ pre-down route del -net 10.0.0.0 netmask
GATEWAY=192.168.1.1
IPADDR=192.168.2.2
IPADDR1=192.168.1.2
+ IPADDR6=2001:1::100/96
IPV6ADDR=2001:1::bbbb/96
IPV6INIT=yes
IPV6_DEFAULTGW=2001:1::1
@@ -1528,6 +1539,7 @@ pre-down route del -net 10.0.0.0 netmask
BRIDGE=br0
DEVICE=eth0
HWADDR=52:54:00:12:34:00
+ IPADDR6=2001:1::100/96
IPV6ADDR=2001:1::100/96
IPV6INIT=yes
NM_CONTROLLED=no
@@ -1541,6 +1553,7 @@ pre-down route del -net 10.0.0.0 netmask
BRIDGE=br0
DEVICE=eth1
HWADDR=52:54:00:12:34:01
+ IPADDR6=2001:1::101/96
IPV6ADDR=2001:1::101/96
IPV6INIT=yes
NM_CONTROLLED=no

View File

@ -0,0 +1,35 @@
--- cloudinit/net/sysconfig.py.orig
+++ cloudinit/net/sysconfig.py
@@ -15,6 +15,7 @@ from .network_state import (
is_ipv6_addr, net_prefix_to_ipv4_mask, subnet_is_ipv6)
LOG = logging.getLogger(__name__)
+PERS_NET_RULES_DEFAULT = 'etc/udev/rules.d/70-persistent-net.rules'
def _make_header(sep='#'):
@@ -276,7 +277,7 @@ class Renderer(renderer.Renderer):
config = {}
self.sysconf_dir = config.get('sysconf_dir', 'etc/sysconfig')
self.netrules_path = config.get(
- 'netrules_path', 'etc/udev/rules.d/70-persistent-net.rules')
+ 'netrules_path', PERS_NET_RULES_DEFAULT)
self.dns_path = config.get('dns_path', 'etc/resolv.conf')
nm_conf_path = 'etc/NetworkManager/conf.d/99-cloud-init.conf'
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_path = util.target_path(target, self.netrules_path)
util.write_file(netrules_path, netrules_content, file_mode)
+ # Making the assumption that the configured file is in a sane
+ # location
+ if (
+ os.path.basename(PERS_NET_RULES_DEFAULT)
+ != os.path.basename(netrules_path)
+ ):
+ util.subp(
+ ['udevadm', 'trigger', '-a ACTION=add', '-a SUBSYSTEM=net']
+ )
sysconfig_path = util.target_path(target, templates.get('control'))
# Distros configuring /etc/sysconfig/network as a file e.g. Centos

View File

@ -1,12 +1,15 @@
--- cloudinit/distros/opensuse.py.orig
+++ cloudinit/distros/opensuse.py
@@ -172,8 +172,40 @@ class Distro(distros.Distro):
@@ -172,7 +172,41 @@ class Distro(distros.Distro):
util.write_file(out_fn, str(conf), 0o644)
def _write_network_config(self, netconfig):
- return self._supported_write_network_config(netconfig)
+ net_apply_res = self._supported_write_network_config(netconfig)
+ # Clobber the route files that were written in RH key-value style
+ self._write_routes(netconfig)
return self._supported_write_network_config(netconfig)
+ return net_apply_res
+
+ def _write_routes(self, netconfig):
+ """Write route files, not part of the standard distro interface"""
+ # Due to the implementation of the sysconfig renderer default routes
@ -37,7 +40,6 @@
+ if config_routes:
+ route_file = '/etc/sysconfig/network/ifroute-%s' % if_name
+ util.write_file(route_file, config_routes)
+
@property
def preferred_ntp_clients(self):
"""The preferred ntp client is dependent on the version."""

View File

@ -1,3 +1,23 @@
-------------------------------------------------------------------
Fri Feb 22 22:11:20 UTC 2019 - Robert Schweikert <rjschwei@suse.com>
- Add cloud-init-trigger-udev.patch (bsc#1125950)
+ When the user configures a new rules file for network devices
the rules may not apply immediately, trigger udevadm
-------------------------------------------------------------------
Fri Feb 22 16:20:28 UTC 2019 - Robert Schweikert <rjschwei@suse.com>
- Modify cloud-init-write-routes.patch (bsc#1125992)
+ Fix the order of calls, the SUSE imaplementation of route config file
writing must clobber the default implementation.
-------------------------------------------------------------------
Fri Feb 22 00:42:14 UTC 2019 - Robert Schweikert <rjschwei@suse.com>
- Add cloud-init-proper-ipv6-varname.patch (bsc#1126101)
+ Use the proper name to designate IPv6 addresses in ifcfg-* files
-------------------------------------------------------------------
Thu Jan 31 17:13:21 UTC 2019 - Robert Schweikert <rjschwei@suse.com>

View File

@ -53,6 +53,10 @@ Patch44: cloud-init-handle-def-route-set.patch
# End lp#1812117
# FIXME (lp#1812853)
Patch45: cloud-init-no-empty-resolv.patch
# FIXME (lp#1817230)
Patch46: cloud-init-proper-ipv6-varname.patch
# FIXME (lp#1817368)
Patch47: cloud-init-trigger-udev.patch
BuildRequires: fdupes
BuildRequires: filesystem
@ -200,6 +204,8 @@ Documentation and examples for cloud-init tools
%patch43
%patch44
%patch45
%patch46
%patch47
%build
%if 0%{?suse_version} && 0%{?suse_version} <= 1315