[PATCH] dracut/parse-kickstart: handle network --mtu

Vratislav Podzimek vpodzime at redhat.com
Mon Apr 15 14:10:18 UTC 2013


On Mon, 2013-04-08 at 13:27 -0400, Will Woods wrote:
> Clean up the network handling a little bit, and add the mtu where dracut
> expects to find it.
> ---
>  dracut/parse-kickstart | 23 ++++++++++++++---------
>  1 file changed, 14 insertions(+), 9 deletions(-)
> 
> diff --git a/dracut/parse-kickstart b/dracut/parse-kickstart
> index d81bdcd..ae34862 100755
> --- a/dracut/parse-kickstart
> +++ b/dracut/parse-kickstart
> @@ -192,6 +192,7 @@ def ksnet_to_dracut(args, lineno, net, bootdev=False):
>      '''Translate the kickstart network data into dracut network data.'''
>      line = []
>      ip=""
> +    autoconf=""
>  
>      if is_mac(net.device): # this is a MAC - find the interface name
>          mac = net.device
> @@ -202,9 +203,9 @@ def ksnet_to_dracut(args, lineno, net, bootdev=False):
>  
>      # NOTE: dracut currently only does ipv4 *or* ipv6, so only one ip=arg..
>      if net.bootProto in (BOOTPROTO_DHCP, BOOTPROTO_BOOTP):
> -        ip="dhcp"
> +        autoconf="dhcp"
>      elif net.bootProto == BOOTPROTO_IBFT:
> -        ip="ibft"
> +        autoconf="ibft"
>      elif net.bootProto == BOOTPROTO_QUERY:
>          log.error("'%s': --bootproto=query is deprecated", " ".join(args))
>      elif net.bootProto == BOOTPROTO_STATIC:
> @@ -214,18 +215,22 @@ def ksnet_to_dracut(args, lineno, net, bootdev=False):
>              log.warn("line %u: network missing %s", lineno, missing)
>          else:
>              ip="{0.ip}::{0.gateway}:{0.netmask}:" \
> -               "{0.hostname}:{0.device}:none".format(net)
> +               "{0.hostname}:{0.device}:none:{0.mtu}".format(net)
>      elif net.ipv6 == "auto":
> -        ip="auto6"
> +        autoconf="auto6"
>      elif net.ipv6 == "dhcp":
> -        ip="dhcp6"
> +        autoconf="dhcp6"
>      elif net.ipv6:
>          ip="[{0.ipv6}]::{0.gateway}:{0.netmask}:" \
> -           "{0.hostname}:{0.device}:none".format(net)
> +           "{0.hostname}:{0.device}:none:{0.mtu}".format(net)
>  
> -    if net.device and not ip.endswith(":none"):
> -        line.append("ip=%s:%s" % (net.device, ip))
> -    else:
> +    if autoconf:
> +        if net.device or net.mtu:
> +            ip="%s:%s:%s" % (net.device, autoconf, net.mtu)
> +        else:
> +            ip=autoconf
> +
> +    if ip:
>          line.append("ip=%s" % ip)
>  
>      for ns in net.nameserver.split(","):
ACK.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list