import dracut-049-218.git20221019.el8

This commit is contained in:
CentOS Sources 2022-11-16 06:08:44 +00:00 committed by Stepan Oksanichenko
parent ae50e1e1ba
commit 4c592498be
10 changed files with 444 additions and 1 deletions

66
SOURCES/0209.patch Normal file
View File

@ -0,0 +1,66 @@
From 7e148e3b6f922e5eb1dcb7fc3c1fed715004e2ab Mon Sep 17 00:00:00 2001
From: Lee Duncan <lduncan@suse.com>
Date: Mon, 25 Mar 2019 16:49:19 -0700
Subject: [PATCH] Dracut: only login to one target at a time
For handling the configuration where there are two
paths to an iscsi root target, each using a different
NIC. In such a case, the initramfs was trying to configure
the first NIC, then call iscsiroot to login to both targets,
which would fail for the 2nd target, since the path to the
2nd target was not yet configured. This would eventually
work after a timeout. But it's better to login to just
one target at a time.
This change makes the initramfs handle multiple paths to an
iscsi target better by logging into only one target at a time,
rather than trying to login to all targets when only one of
several NICs is up.
This can be further optimized by using the initrd parameter
"rd.iscsi.testroute", which would skip iscsiadm login attempts
for targets to which no route exists.
If the script is called again via the timeout initqueue,
we try "iscsiadm -L onboot" again, hoping that some targets
may now have become reachable.
---
modules.d/95iscsi/iscsiroot.sh | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh
index 4efc1d12..f3f88259 100755
--- a/modules.d/95iscsi/iscsiroot.sh
+++ b/modules.d/95iscsi/iscsiroot.sh
@@ -228,7 +228,7 @@ handle_netroot()
fi
[ -n "$iscsi_param" ] && for param in $iscsi_param; do EXTRA="$EXTRA --name=${param%=*} --value=${param#*=}"; done
- iscsiadm -m node -T $target \
+ CMD="iscsiadm -m node -T $target \
${iscsi_iface_name:+-I $iscsi_iface_name} \
-p $iscsi_target_ip${iscsi_target_port:+:$iscsi_target_port} \
--op=update \
@@ -238,14 +238,20 @@ handle_netroot()
${iscsi_in_username:+--name=node.session.auth.username_in --value=$iscsi_in_username} \
${iscsi_in_password:+--name=node.session.auth.password_in --value=$iscsi_in_password} \
$EXTRA \
- $NULL
+ $NULL"
+ $CMD
+ if [ "$netif" != "timeout" ]; then
+ $CMD --login
+ fi
;;
*)
;;
esac
done
- iscsiadm -m node -L onboot || :
+ if [ "$netif" = "timeout" ]; then
+ iscsiadm -m node -L onboot || :
+ fi
> $hookdir/initqueue/work
netroot_enc=$(str_replace "$1" '/' '\2f')

39
SOURCES/0210.patch Normal file
View File

@ -0,0 +1,39 @@
From 96fc660c9170fbea5ac80235ab7d0e7cfdbe243e Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.de>
Date: Thu, 21 Mar 2019 16:27:04 +0100
Subject: [PATCH] iscsi: don't continue waiting if the root device is present
dracut waits for every iscsiroot connection to be established
before switching root. This is not necessary in multipath scenarios,
where a single path is usually sufficient to set up the root device,
and where users expect booting to succeed unless all paths are down.
Don't wait for the iscsi portal to start if the root device has
already been found.
---
modules.d/95iscsi/parse-iscsiroot.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules.d/95iscsi/parse-iscsiroot.sh b/modules.d/95iscsi/parse-iscsiroot.sh
index f00a83bb..8d6e3e8c 100755
--- a/modules.d/95iscsi/parse-iscsiroot.sh
+++ b/modules.d/95iscsi/parse-iscsiroot.sh
@@ -84,7 +84,7 @@ if [ -n "$iscsi_firmware" ]; then
modprobe -b -q iscsi_boot_sysfs 2>/dev/null
modprobe -b -q iscsi_ibft
# if no ip= is given, but firmware
- echo "[ -f '/tmp/iscsistarted-firmware' ]" > $hookdir/initqueue/finished/iscsi_started.sh
+ echo "${DRACUT_SYSTEMD+systemctl is-active initrd-root-device.target || }[ -f '/tmp/iscsistarted-firmware' ]" > $hookdir/initqueue/finished/iscsi_started.sh
initqueue --unique --online /sbin/iscsiroot online "iscsi:" "$NEWROOT"
initqueue --unique --onetime --timeout /sbin/iscsiroot timeout "iscsi:" "$NEWROOT"
initqueue --unique --onetime --settled /sbin/iscsiroot online "iscsi:" "'$NEWROOT'"
@@ -145,7 +145,7 @@ for nroot in $(getargs netroot); do
type parse_iscsi_root >/dev/null 2>&1 || . /lib/net-lib.sh
parse_iscsi_root "$nroot" || return 1
netroot_enc=$(str_replace "$nroot" '/' '\2f')
- echo "[ -f '/tmp/iscsistarted-$netroot_enc' ]" > $hookdir/initqueue/finished/iscsi_started.sh
+ echo "${DRACUT_SYSTEMD+systemctl is-active initrd-root-device.target || }[ -f '/tmp/iscsistarted-$netroot_enc' ]" > $hookdir/initqueue/finished/iscsi_started.sh
done
# Done, all good!

24
SOURCES/0211.patch Normal file
View File

@ -0,0 +1,24 @@
From 5e06ab6cc6398fb82b8cd1dbc8da9969d874bb75 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.de>
Date: Thu, 21 Mar 2019 21:31:15 +0100
Subject: [PATCH] network: stop waiting for interfaces if root device is
present
---
modules.d/35network-legacy/net-genrules.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/35network-legacy/net-genrules.sh b/modules.d/35network-legacy/net-genrules.sh
index e6035e5e..0d4ef27b 100755
--- a/modules.d/35network-legacy/net-genrules.sh
+++ b/modules.d/35network-legacy/net-genrules.sh
@@ -96,7 +96,7 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
for iface in $IFACES; do
if [ "$bootdev" = "$iface" ] || [ "$NEEDNET" = "1" ]; then
- echo "[ -f /tmp/net.${iface}.did-setup ]" >$hookdir/initqueue/finished/wait-$iface.sh
+ echo "${DRACUT_SYSTEMD+systemctl is-active initrd-root-device.target || }[ -f /tmp/net.${iface}.did-setup ]" >$hookdir/initqueue/finished/wait-$iface.sh
fi
done
# Default: We don't know the interface to use, handle all

39
SOURCES/0212.patch Normal file
View File

@ -0,0 +1,39 @@
From 032129d0eb47d08eff7bd8b4c82a835a8929e9d3 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.de>
Date: Thu, 4 Apr 2019 15:29:04 +0200
Subject: [PATCH] iscsiroot: parse_iscsi_root overwrites command line args
iscsi_target_name, iscsi_target_ip, iscsi_target_port are
unconditionally overwritten by parse_iscsi_root. Don't set
them here, for code clarity.
---
modules.d/95iscsi/iscsiroot.sh | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh
index f3f88259..45db89c1 100755
--- a/modules.d/95iscsi/iscsiroot.sh
+++ b/modules.d/95iscsi/iscsiroot.sh
@@ -92,12 +92,6 @@ handle_netroot()
# override conf settings by command line options
arg=$(getarg rd.iscsi.initiator -d iscsi_initiator=)
[ -n "$arg" ] && iscsi_initiator=$arg
- arg=$(getargs rd.iscsi.target.name -d iscsi_target_name=)
- [ -n "$arg" ] && iscsi_target_name=$arg
- arg=$(getarg rd.iscsi.target.ip -d iscsi_target_ip)
- [ -n "$arg" ] && iscsi_target_ip=$arg
- arg=$(getarg rd.iscsi.target.port -d iscsi_target_port=)
- [ -n "$arg" ] && iscsi_target_port=$arg
arg=$(getarg rd.iscsi.target.group -d iscsi_target_group=)
[ -n "$arg" ] && iscsi_target_group=$arg
arg=$(getarg rd.iscsi.username -d iscsi_username=)
@@ -112,6 +106,8 @@ handle_netroot()
iscsi_param="$iscsi_param $p"
done
+ # this sets iscsi_target_name and possibly overwrites most
+ # parameters read from the command line above
parse_iscsi_root "$1" || return 1
# Bail out early, if there is no route to the destination

42
SOURCES/0213.patch Normal file
View File

@ -0,0 +1,42 @@
From a590dfb3670a68b9eebc3e0ea617c5cf192c51ae Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.de>
Date: Thu, 4 Apr 2019 15:40:14 +0200
Subject: [PATCH] iscsiroot: there's never more than one target per call
iscsi_target_name is set by iscsi_root, and thus can't have
more than one member. This allows us to get rid of one bashism
in iscsiroot.sh.
---
modules.d/95iscsi/iscsiroot.sh | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh
index 45db89c1..a334b76e 100755
--- a/modules.d/95iscsi/iscsiroot.sh
+++ b/modules.d/95iscsi/iscsiroot.sh
@@ -213,10 +213,8 @@ handle_netroot()
targets=$(iscsiadm -m discovery -t st -p $iscsi_target_ip:${iscsi_target_port:+$iscsi_target_port} | sed 's/^.*iqn/iqn/')
[ -z "$targets" ] && echo "Target discovery to $iscsi_target_ip:${iscsi_target_port:+$iscsi_target_port} failed with status $?" && exit 1
- for target in $iscsi_target_name; do
- case "$targets" in
- *$target*)
- EXTRA=""
+ for target in $targets; do
+ if [ "$target" = "$iscsi_target_name" ]; then
if [ -n "$iscsi_iface_name" ]; then
iscsiadm -m iface -I $iscsi_iface_name --op=new
EXTRA=" ${iscsi_netdev_name:+--name=iface.net_ifacename --value=$iscsi_netdev_name} "
@@ -239,10 +237,7 @@ handle_netroot()
if [ "$netif" != "timeout" ]; then
$CMD --login
fi
- ;;
- *)
- ;;
- esac
+ fi
done
if [ "$netif" = "timeout" ]; then

55
SOURCES/0214.patch Normal file
View File

@ -0,0 +1,55 @@
From 261d278332e0af85a0311a75d7b81c6cf35e4816 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.de>
Date: Thu, 4 Apr 2019 16:16:40 +0200
Subject: [PATCH] iscsiroot: try targets only once
In multipath scenarios, "iscsiadm -m node" may contain
several records with the same target.
There's no point in trying "iscsiadm --login" multiple
time for the same target, through the same portal.
Moreover, warn if the desired target is not on the node
list.
---
modules.d/95iscsi/iscsiroot.sh | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh
index a334b76e..e8e0b4b8 100755
--- a/modules.d/95iscsi/iscsiroot.sh
+++ b/modules.d/95iscsi/iscsiroot.sh
@@ -87,7 +87,7 @@ handle_netroot()
local iscsi_in_username iscsi_in_password
local iscsi_iface_name iscsi_netdev_name
local iscsi_param param
- local p
+ local p found
# override conf settings by command line options
arg=$(getarg rd.iscsi.initiator -d iscsi_initiator=)
@@ -213,6 +213,7 @@ handle_netroot()
targets=$(iscsiadm -m discovery -t st -p $iscsi_target_ip:${iscsi_target_port:+$iscsi_target_port} | sed 's/^.*iqn/iqn/')
[ -z "$targets" ] && echo "Target discovery to $iscsi_target_ip:${iscsi_target_port:+$iscsi_target_port} failed with status $?" && exit 1
+ found=
for target in $targets; do
if [ "$target" = "$iscsi_target_name" ]; then
if [ -n "$iscsi_iface_name" ]; then
@@ -237,11 +238,16 @@ handle_netroot()
if [ "$netif" != "timeout" ]; then
$CMD --login
fi
+ found=yes
+ break
fi
done
if [ "$netif" = "timeout" ]; then
iscsiadm -m node -L onboot || :
+ elif [ "$found" != yes ]; then
+ warn "iSCSI target \"$iscsi_target_name\" not found on portal $iscsi_target_ip:$iscsi_target_port"
+ return 1
fi
> $hookdir/initqueue/work

77
SOURCES/0215.patch Normal file
View File

@ -0,0 +1,77 @@
From 0df65c3c001fb5656838274b172c247c41dc0442 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.de>
Date: Thu, 4 Apr 2019 17:12:07 +0200
Subject: [PATCH] iscsiroot: remove bashisms
According to the dracut README, module code to be run in
the initrd must be POSIX-compliant. Replace remaining
bashisms (as reported by checkbashisms) with POSIX compliant
code.
The use of "type" is not strictly POSIX compliant, but it's
all over the place in dracut code. dash supports it, anyway.
---
modules.d/95iscsi/iscsiroot.sh | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh
index e8e0b4b8..4ab0b6a0 100755
--- a/modules.d/95iscsi/iscsiroot.sh
+++ b/modules.d/95iscsi/iscsiroot.sh
@@ -54,11 +54,11 @@ handle_firmware()
if ! iscsiadm -m fw; then
warn "iscsiadm: Could not get list of targets from firmware."
else
- ifaces=( $(echo /sys/firmware/ibft/ethernet*) )
+ ifaces=$(set -- /sys/firmware/ibft/ethernet*; echo $#)
retry=$(cat /tmp/session-retry)
- if [ $retry -lt ${#ifaces[*]} ]; then
- let retry++
+ if [ $retry -lt $ifaces ]; then
+ retry=$((retry+1))
echo $retry > /tmp/session-retry
return 1
else
@@ -88,6 +88,7 @@ handle_netroot()
local iscsi_iface_name iscsi_netdev_name
local iscsi_param param
local p found
+ local login_retry_max_seen=
# override conf settings by command line options
arg=$(getarg rd.iscsi.initiator -d iscsi_initiator=)
@@ -103,7 +104,9 @@ handle_netroot()
arg=$(getarg rd.iscsi.in.password -d iscsi_in_password=)
[ -n "$arg" ] && iscsi_in_password=$arg
for p in $(getargs rd.iscsi.param -d iscsi_param); do
- iscsi_param="$iscsi_param $p"
+ [ "${p%=*}" = node.session.initial_login_retry_max ] && \
+ login_retry_max_seen=yes
+ iscsi_param="$iscsi_param $p"
done
# this sets iscsi_target_name and possibly overwrites most
@@ -116,15 +119,12 @@ handle_netroot()
fi
#limit iscsistart login retries
- case "$iscsi_param" in
- *node.session.initial_login_retry_max*) ;;
- *)
- retries=$(getargnum 3 0 10000 rd.iscsi.login_retry_max)
- if [ $retries -gt 0 ]; then
- iscsi_param="${iscsi_param% } node.session.initial_login_retry_max=$retries"
- fi
- ;;
- esac
+ if [ "$login_retry_max_seen" != yes ]; then
+ retries=$(getargnum 3 0 10000 rd.iscsi.login_retry_max)
+ if [ $retries -gt 0 ]; then
+ iscsi_param="${iscsi_param% } node.session.initial_login_retry_max=$retries"
+ fi
+ fi
# XXX is this needed?
getarg ro && iscsirw=ro

44
SOURCES/0216.patch Normal file
View File

@ -0,0 +1,44 @@
From ee0bba8d350920b8beb4c0629262ec359983ad65 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.de>
Date: Tue, 1 Oct 2019 12:02:04 +0200
Subject: [PATCH] fixup "Dracut: only login to one target at a time"
On SLE15-SP1 at least, iscsiadm doesn't support combining --op and --login":
> # iscsiadm -m node -T iqn.2018-06.de.suse.zeus:01 --op=update --name=node.startup --value=onboot --login
> iscsiadm: Invalid parameters. Login/logout and op passed in
This breaks iSCSI login in initrd, and thus, iSCSI boot.
Fix it by not coalescing everything into a single iscsiadm command.
Fixes: a59b776bc215 ("Dracut: only login to one target at a time")
References: bsc#1152650
---
modules.d/95iscsi/iscsiroot.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh
index 4ab0b6a0..6a12a108 100755
--- a/modules.d/95iscsi/iscsiroot.sh
+++ b/modules.d/95iscsi/iscsiroot.sh
@@ -225,8 +225,8 @@ handle_netroot()
CMD="iscsiadm -m node -T $target \
${iscsi_iface_name:+-I $iscsi_iface_name} \
- -p $iscsi_target_ip${iscsi_target_port:+:$iscsi_target_port} \
- --op=update \
+ -p $iscsi_target_ip${iscsi_target_port:+:$iscsi_target_port}"
+ __op="--op=update \
--name=node.startup --value=onboot \
${iscsi_username:+ --name=node.session.auth.username --value=$iscsi_username} \
${iscsi_password:+ --name=node.session.auth.password --value=$iscsi_password} \
@@ -234,7 +234,7 @@ handle_netroot()
${iscsi_in_password:+--name=node.session.auth.password_in --value=$iscsi_in_password} \
$EXTRA \
$NULL"
- $CMD
+ $CMD $__op
if [ "$netif" != "timeout" ]; then
$CMD --login
fi

37
SOURCES/0217.patch Normal file
View File

@ -0,0 +1,37 @@
From 934e69b64f4eff5df84d0d94a39aca1933bf3419 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.de>
Date: Fri, 27 Sep 2019 13:26:10 +0200
Subject: [PATCH] 35network-legacy: only skip waiting for interfaces if netroot
is set
Commmit 8a33e52e2f94 assumes that dracut's work is done if a root device
is found. This holds usually for booting computers, but it may be wrong
for other environments.
Only short-cut the waiting if $netroot is also set.
Fixes: 8a33e52e2f94 ("network: stop waiting for interfaces if root device is present")
References: bsc#1152006
Resolves: rhbz#2115199
---
modules.d/35network-legacy/net-genrules.sh | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/modules.d/35network-legacy/net-genrules.sh b/modules.d/35network-legacy/net-genrules.sh
index 0d4ef27b..d531bb56 100755
--- a/modules.d/35network-legacy/net-genrules.sh
+++ b/modules.d/35network-legacy/net-genrules.sh
@@ -96,7 +96,11 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
for iface in $IFACES; do
if [ "$bootdev" = "$iface" ] || [ "$NEEDNET" = "1" ]; then
- echo "${DRACUT_SYSTEMD+systemctl is-active initrd-root-device.target || }[ -f /tmp/net.${iface}.did-setup ]" >$hookdir/initqueue/finished/wait-$iface.sh
+ if [ -n "$netroot" ] && [ -n "$DRACUT_SYSTEMD" ]; then
+ echo "systemctl is-active initrd-root-device.target || [ -f /tmp/net.${iface}.did-setup ]"
+ else
+ echo "[ -f /tmp/net.${iface}.did-setup ]"
+ fi >$hookdir/initqueue/finished/wait-$iface.sh
fi
done
# Default: We don't know the interface to use, handle all

View File

@ -5,7 +5,7 @@
# strip the automatically generated dep here and instead co-own the
# directory.
%global __requires_exclude pkg-config
%define dist_free_release 209.git20220815
%define dist_free_release 218.git20221019
Name: dracut
Version: 049
@ -236,6 +236,15 @@ Patch205: 0205.patch
Patch206: 0206.patch
Patch207: 0207.patch
Patch208: 0208.patch
Patch209: 0209.patch
Patch210: 0210.patch
Patch211: 0211.patch
Patch212: 0212.patch
Patch213: 0213.patch
Patch214: 0214.patch
Patch215: 0215.patch
Patch216: 0216.patch
Patch217: 0217.patch
Source1: https://www.gnu.org/licenses/lgpl-2.1.txt
@ -690,6 +699,17 @@ echo '# Since rhel-8.3 dracut moved to use NetworkManager
add_dracutmodules+=" network-legacy "' > /etc/dracut.conf.d/50-network-legacy.conf
%changelog
* Thu Oct 20 2022 Pavel Valena <pvalena@redhat.com> - 049-218.git20221019
- Dracut: only login to one target at a time
- iscsi: don't continue waiting if the root device is present
- network: stop waiting for interfaces if root device is
- iscsiroot: parse_iscsi_root overwrites command line args
- iscsiroot: there's never more than one target per call
- iscsiroot: try targets only once
- iscsiroot: remove bashisms
- fixup "Dracut: only login to one target at a time"
- 35network-legacy: only skip waiting for interfaces if netroot
* Mon Aug 15 2022 Pavel Valena <pvalena@redhat.com> - 049-209.git20220815
- fix(95iscsi): Fix network setup
- fix(dracut-systemd): correct service dependencies