cloud-init-dev team mailing list archive
-
cloud-init-dev team
-
Mailing list archive
-
Message #04729
Re: [Merge] ~mgerdts/cloud-init:lp1763512 into cloud-init:master
Diff comments:
> diff --git a/cloudinit/sources/DataSourceSmartOS.py b/cloudinit/sources/DataSourceSmartOS.py
> index 4ea00eb..db4329d 100644
> --- a/cloudinit/sources/DataSourceSmartOS.py
> +++ b/cloudinit/sources/DataSourceSmartOS.py
> @@ -862,10 +873,49 @@ def convert_smartos_network_data(network_data=None,
> pgws[proto]['gw'] = gateways[0]
> subnet.update({'gateway': pgws[proto]['gw']})
>
> + for route in routes:
> + rcfg = dict((k, v) for k, v in route.items()
> + if k in valid_keys['route'])
> + # Linux uses the value of 'gateway' to determine
> + # automatically if the route is a forward/next-hop
> + # (non-local IP for gateway) or an interface/resolver
> + # (local IP for gateway). So we can ignore the
> + # 'interface' attribute of sdc:routes, because SDC
> + # guarantees that the gateway is a local IP for
> + # "interface=true".
> + #
> + # Eventually we should be smart and compare "gateway"
> + # to see if it's in the prefix. We can then smartly
> + # add or not-add this route. But for now,
> + # when in doubt, use brute force! Routes for everyone!
> + rcfg.update({
> + 'network': route['dst'],
> + 'gateway': route['gateway'],
> + })
> + routeents.append(rcfg)
> + subnet.update({'routes': routeents})
> +
> subnets.append(subnet)
> cfg.update({'subnets': subnets})
> config.append(cfg)
>
> + # More brute force, add routes here at the global-scope too, although
> + # this doesn't work. Not sure if it's a documentation mismatch or a
> + # problem with certain hosts (like Ubuntu 17+ featuring netplan).
This is by design for netplan; I don't think this should be needed if you're putting routes under a given interface; that will get rendered correctly for all backends and distros.
> + for route in routes:
> + cfg = dict((k, v) for k, v in route.items()
> + if k in valid_keys['route'])
> + # Linux uses the value of 'gateway' to determine automatically if
> + # the route is a forward/next-hop (non-local IP for gateway) or an
> + # interface/resolver (local IP for gateway). So we can ignore
> + # the 'interface' attribute of sdc:routes, because SDC guarantees
> + # that the gateway is a local IP for "interface=true".
> + cfg.update({
> + 'type': 'route',
> + 'destination': route['dst'],
> + 'gateway': route['gateway']})
> + config.append(cfg)
> +
> if dns_servers:
> config.append(
> {'type': 'nameserver', 'address': dns_servers,
--
https://code.launchpad.net/~mgerdts/cloud-init/+git/cloud-init/+merge/344168
Your team cloud-init commiters is requested to review the proposed merge of ~mgerdts/cloud-init:lp1763512 into cloud-init:master.
References