Skip to content

Commit

Permalink
Merge pull request #342 from aafeijoo-suse/059-consolidate-s390-tools
Browse files Browse the repository at this point in the history
Consolidated s390 device configuration
  • Loading branch information
aafeijoo-suse authored Jun 25, 2024
2 parents 8870645 + 0ce3a10 commit ab27ef7
Show file tree
Hide file tree
Showing 21 changed files with 191 additions and 574 deletions.
12 changes: 0 additions & 12 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -382,10 +382,6 @@ dasd_mod:
- changed-files:
- any-glob-to-any-file: 'modules.d/95dasd_mod/*'

dasd_rules:
- changed-files:
- any-glob-to-any-file: 'modules.d/95dasd_rules/*'

dcssblk:
- changed-files:
- any-glob-to-any-file: 'modules.d/95dcssblk/*'
Expand Down Expand Up @@ -426,10 +422,6 @@ nvmf:
- changed-files:
- any-glob-to-any-file: 'modules.d/95nvmf/*'

qeth_rules:
- changed-files:
- any-glob-to-any-file: 'modules.d/95qeth_rules/*'

resume:
- changed-files:
- any-glob-to-any-file: 'modules.d/95resume/*'
Expand Down Expand Up @@ -462,10 +454,6 @@ zfcp:
- changed-files:
- any-glob-to-any-file: 'modules.d/95zfcp/*'

zfcp_rules:
- changed-files:
- any-glob-to-any-file: 'modules.d/95zfcp_rules/*'

znet:
- changed-files:
- any-glob-to-any-file: 'modules.d/95znet/*'
Expand Down
32 changes: 27 additions & 5 deletions man/dracut.cmdline.7.asc
Original file line number Diff line number Diff line change
Expand Up @@ -972,19 +972,38 @@ root=virtiofs:host rw
DASD
~~~~
**rd.dasd=**....::
same syntax as the kernel module parameter (s390 only)
same syntax as the kernel module parameter (s390 only).
For more details on the syntax see the IBM book
"Linux on IBM Z and IBM LinuxONE - Device Drivers, Features, and Commands"
https://www.ibm.com/docs/en/linux-on-systems?topic=overview-device-drivers-features-commands.
This parameter can be specified multiple times.
+
NOTE:
This parameter is no longer handled by dracut itself but with the exact
same syntax by
https://github.com/ibm-s390-linux/s390-tools/tree/master/zdev/dracut/95zdev.
ZFCP
~~~~
**rd.zfcp=**__<zfcp adaptor device bus ID>__,__<WWPN>__,__<FCPLUN>__::
rd.zfcp can be specified multiple times on the kernel command
line.
+
NOTE:
This parameter is no longer handled by dracut itself but with the exact
same syntax by
https://github.com/ibm-s390-linux/s390-tools/tree/master/zdev/dracut/95zdev.
**rd.zfcp=**__<zfcp adaptor device bus ID>__::
If NPIV is enabled and the 'allow_lun_scan' parameter to the zfcp
module is set to 'Y' then the zfcp adaptor will be initiating a
module is set to 'Y' then the zfcp driver will be initiating a
scan internally and the <WWPN> and <FCPLUN> parameters can be omitted.
+
NOTE:
This parameter is no longer handled by dracut itself but with the exact
same syntax by
https://github.com/ibm-s390-linux/s390-tools/tree/master/zdev/dracut/95zdev.
+
[listing]
.Example
--
Expand All @@ -998,9 +1017,12 @@ rd.zfcp=0.0.4000
ZNET
~~~~
**rd.znet=**__<nettype>__,__<subchannels>__,__<options>__::
The whole parameter is appended to /etc/ccw.conf, which is used on
RHEL/Fedora with ccw_init, which is called from udev for certain
devices on z-series.
Activates a channel-attached network interface on s390 architecture.
<nettype> is one of: qeth, lcs, ctc.
<subchannels> is a comma-separated list of ccw device bus-IDs.
The list consists of 3 entries with nettype qeth, and 2 for other nettype.
<options> is a comma-separated list of <name>=<value> pairs,
where <name> refers to a device sysfs attribute to which <value> gets written.
rd.znet can be specified multiple times on the kernel command line.
**rd.znet_ifname=**__<ifname>__:__<subchannels>__::
Expand Down
51 changes: 2 additions & 49 deletions modules.d/45ifcfg/write-ifcfg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,68 +10,21 @@ mkdir -m 0755 -p /tmp/ifcfg/
# shellcheck disable=SC2174
mkdir -m 0755 -p /tmp/ifcfg-leases/

get_config_line_by_subchannel() {
local CHANNELS
local line

CHANNELS="$1"
while read -r line || [ -n "$line" ]; do
if strstr "$line" "$CHANNELS"; then
echo "$line"
return 0
fi
done < /etc/ccw.conf
return 1
}

print_s390() {
local _netif
local SUBCHANNELS
local OPTIONS
local NETTYPE
local CONFIG_LINE
local i
local channel
local OLD_IFS

_netif="$1"
# if we find ccw channel, then use those, instead of
# of the MAC
SUBCHANNELS=$({
for i in /sys/class/net/"$_netif"/device/cdev[0-9]*; do
[ -e "$i" ] || continue
channel=$(readlink -f "$i")
printf '%s' "${channel##*/},"
done
})
# [iface_get_subchannels() from /lib/net-lib.sh sourced at top of this file]
SUBCHANNELS=$(iface_get_subchannels "$_netif")
[ -n "$SUBCHANNELS" ] || return 1

SUBCHANNELS=${SUBCHANNELS%,}
echo "SUBCHANNELS=\"${SUBCHANNELS}\""

CONFIG_LINE=$(get_config_line_by_subchannel "$SUBCHANNELS")
# shellcheck disable=SC2181
[ $? -ne 0 -o -z "$CONFIG_LINE" ] && return 0

OLD_IFS=$IFS
IFS=","
# shellcheck disable=SC2086
set -- $CONFIG_LINE
IFS=$OLD_IFS
NETTYPE=$1
shift
SUBCHANNELS="$1"
OPTIONS=""
shift
while [ $# -gt 0 ]; do
case $1 in
*=*) OPTIONS="$OPTIONS $1" ;;
esac
shift
done
OPTIONS=${OPTIONS## }
echo "NETTYPE=\"${NETTYPE}\""
echo "OPTIONS=\"${OPTIONS}\""
return 0
}

Expand Down
13 changes: 0 additions & 13 deletions modules.d/80cms/cms-write-ifcfg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,8 @@ EOF
fi
# colons in SEARCHDNS already replaced with spaces above for /etc/resolv.conf
[[ $SEARCHDNS ]] && echo "DOMAIN=\"$SEARCHDNS\"" >> "$IFCFGFILE"
[[ $NETTYPE ]] && echo "NETTYPE=$NETTYPE" >> "$IFCFGFILE"
[[ $PEERID ]] && echo "PEERID=$PEERID" >> "$IFCFGFILE"
[[ $PORTNAME ]] && echo "PORTNAME=$PORTNAME" >> "$IFCFGFILE"
[[ $CTCPROT ]] && echo "CTCPROT=$CTCPROT" >> "$IFCFGFILE"
[[ $MACADDR ]] && echo "MACADDR=$MACADDR" >> "$IFCFGFILE"
optstr=""
for option in LAYER2 PORTNO; do
[ -z "${!option}" ] && continue
[ -n "$optstr" ] && optstr=${optstr}" "
optstr=${optstr}$(echo ${option} | sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/')"="${!option}
done
# write single quotes since network.py removes double quotes but we need quotes
echo "OPTIONS='$optstr'" >> "$IFCFGFILE"
unset option
unset optstr
unset DNS1
unset DNS2
echo "files /etc/sysconfig/network-scripts" >> /run/initramfs/rwtab
Expand Down
Loading

0 comments on commit ab27ef7

Please sign in to comment.