Merge ~smoser/cloud-init:feature/curtin-centos5 into cloud-init:master

Proposed by Scott Moser
Status: Merged
Merged at revision: 31fa6f9d0f945868349c033fa049d2467ddcd478
Proposed branch: ~smoser/cloud-init:feature/curtin-centos5
Merge into: cloud-init:master
Diff against target: 54 lines (+8/-6)
2 files modified
cloudinit/net/sysconfig.py (+6/-5)
tests/unittests/test_net.py (+2/-1)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
Ryan Harper Approve
Review via email: mp+327828@code.launchpad.net

Commit message

sysconfig: fix ipv6 gateway routes

Currently only the subnet is checked for 'ipv6' setting, however, the
routes array may include a mix of v4 or v6 configurations, in particular,
the gateway in a route may be ipv6, and if so, should export the value via
IPV6_DEFAULTGW in the ifcfg-XXXX file.

Additionally, if the route is v6, it should rendering a routes6-XXXX file;
this is present but missing the 'dev <interface>' scoping.

LP: #1694801

To post a comment you must log in.
Revision history for this message
Ryan Harper (raharper) :
review: Approve
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:f4875b035d9a7cd94d32ac028f66844a22f7d34e
https://jenkins.ubuntu.com/server/job/cloud-init-ci/63/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Unit & Style Tests
    SUCCESS: Ubuntu LTS: Build
    SUCCESS: Ubuntu LTS: Integration
    SUCCESS: CentOS 6 & 7: Build & Test
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/63/rebuild

review: Approve (continuous-integration)
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:31fa6f9d0f945868349c033fa049d2467ddcd478
https://jenkins.ubuntu.com/server/job/cloud-init-ci/66/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Unit & Style Tests
    SUCCESS: Ubuntu LTS: Build
    SUCCESS: Ubuntu LTS: Integration
    SUCCESS: CentOS 6 & 7: Build & Test
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/66/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py
2index eb3c91d..abdd4de 100644
3--- a/cloudinit/net/sysconfig.py
4+++ b/cloudinit/net/sysconfig.py
5@@ -152,9 +152,10 @@ class Route(ConfigMap):
6 elif proto == "ipv6" and self.is_ipv6_route(address_value):
7 netmask_value = str(self._conf['NETMASK' + index])
8 gateway_value = str(self._conf['GATEWAY' + index])
9- buf.write("%s/%s via %s\n" % (address_value,
10- netmask_value,
11- gateway_value))
12+ buf.write("%s/%s via %s dev %s\n" % (address_value,
13+ netmask_value,
14+ gateway_value,
15+ self._route_name))
16
17 return buf.getvalue()
18
19@@ -334,7 +335,7 @@ class Renderer(renderer.Renderer):
20 def _render_subnet_routes(cls, iface_cfg, route_cfg, subnets):
21 for i, subnet in enumerate(subnets, start=len(iface_cfg.children)):
22 for route in subnet.get('routes', []):
23- is_ipv6 = subnet.get('ipv6')
24+ is_ipv6 = subnet.get('ipv6') or is_ipv6_addr(route['gateway'])
25
26 if _is_default_route(route):
27 if (
28@@ -356,7 +357,7 @@ class Renderer(renderer.Renderer):
29 # also provided the default route?
30 iface_cfg['DEFROUTE'] = True
31 if 'gateway' in route:
32- if is_ipv6:
33+ if is_ipv6 or is_ipv6_addr(route['gateway']):
34 iface_cfg['IPV6_DEFAULTGW'] = route['gateway']
35 route_cfg.has_set_default_ipv6 = True
36 else:
37diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
38index f786eea..c012600 100644
39--- a/tests/unittests/test_net.py
40+++ b/tests/unittests/test_net.py
41@@ -949,11 +949,12 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
42 BOOTPROTO=none
43 DEFROUTE=yes
44 DEVICE=en0.99
45- GATEWAY=2001:1::1
46+ GATEWAY=192.168.1.1
47 IPADDR=192.168.2.2
48 IPADDR1=192.168.1.2
49 IPV6ADDR=2001:1::bbbb/96
50 IPV6INIT=yes
51+ IPV6_DEFAULTGW=2001:1::1
52 NETMASK=255.255.255.0
53 NETMASK1=255.255.255.0
54 NM_CONTROLLED=no

Subscribers

People subscribed via source and target branches