From 872eb69936bd849eec6d1974dd6569f23a7ad3db Mon Sep 17 00:00:00 2001 From: Kairui Song Date: Thu, 5 Mar 2020 18:44:45 +0800 Subject: [PATCH] 95znet: Add a rd.znet_ifname= option qeth device may have a different IP for each boot, so the rd.ifname= option will no longer work. So for znet device, introduce a rd.znet_ifname= options, to subchannel id instead of MAC address as the identifier and rename the interface. Signed-off-by: Kairui Song --- dracut.cmdline.7.asc | 5 +++++ modules.d/95znet/parse-ccw.sh | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc index 63074353..2b38aa33 100644 --- a/dracut.cmdline.7.asc +++ b/dracut.cmdline.7.asc @@ -863,6 +863,11 @@ ZNET RHEL/Fedora with ccw_init, which is called from udev for certain devices on z-series. rd.znet can be specified multiple times on the kernel command line. + +**rd.znet_ifname=**____:____:: + Assign network device name (i.e. "bootnet") to the NIC + corresponds to the subchannels. This is useful when dracut's default + "ifname=" doesn't work due to device having a changing MAC address. + [listing] .Example diff --git a/modules.d/95znet/parse-ccw.sh b/modules.d/95znet/parse-ccw.sh index 7d40a1aa..59b588f3 100755 --- a/modules.d/95znet/parse-ccw.sh +++ b/modules.d/95znet/parse-ccw.sh @@ -4,4 +4,22 @@ for ccw_arg in $(getargs rd.ccw -d 'rd_CCW=') $(getargs rd.znet -d 'rd_ZNET='); echo $ccw_arg >> /etc/ccw.conf done +for ifname in $(getargs rd.znet_ifname); do + IFS=: read ifname_if ifname_subchannels _rest <<< "$ifname" + if [ -z "$ifname_if" ] || [ -z "$ifname_subchannels" ] || [ -n "$_rest" ]; then + warn "Invalid arguments for rd.znet_ifname=" + else + { + ifname_subchannels=${ifname_subchannels//,/|} + + echo 'ACTION!="add|change", GOTO="ccw_ifname_end"' + echo 'ATTR{type}!="1", GOTO="ccw_ifname_end"' + echo 'SUBSYSTEM!="net", GOTO="ccw_ifname_end"' + echo "SUBSYSTEMS==\"ccwgroup\", KERNELS==\"$ifname_subchannels\", DRIVERS==\"?*\" NAME=\"$ifname_if\"" + echo 'LABEL="ccw_ifname_end"' + + } > /etc/udev/rules.d/81-ccw-ifname.rules + fi +done + znet_cio_free