|
|
6f7af4 |
From 93b0bbd54736259792ca77746ac8a6440c3ccd39 Mon Sep 17 00:00:00 2001
|
|
|
6f7af4 |
From: The Plumber <50238977+systemd-rhel-bot@users.noreply.github.com>
|
|
|
6f7af4 |
Date: Thu, 11 Aug 2022 09:49:54 +0200
|
|
|
6f7af4 |
Subject: [PATCH] (#1933679) 95iscsi: Fix network setup
|
|
|
6f7af4 |
|
|
|
6f7af4 |
* 95iscsi: Fix network setup code for iscsi
|
|
|
6f7af4 |
|
|
|
6f7af4 |
- The network script and config could be in
|
|
|
6f7af4 |
"/etc/sysconfig/network-scripts", so try look for network config in
|
|
|
6f7af4 |
all possible path.
|
|
|
6f7af4 |
|
|
|
6f7af4 |
- The regex used for sed is not working, so fix it too.
|
|
|
6f7af4 |
|
|
|
6f7af4 |
- Make bootproto a local variable
|
|
|
6f7af4 |
|
|
|
6f7af4 |
* Update modules.d/95iscsi/module-setup.sh
|
|
|
6f7af4 |
|
|
|
6f7af4 |
Signed-off-by: Kairui Song <kasong@redhat.com>
|
|
|
6f7af4 |
(cherry picked from commit 7b76fa924dfd20d3fd4433baa8292f0112282aac)
|
|
|
6f7af4 |
|
|
|
6f7af4 |
Resolves: #1933679
|
|
|
6f7af4 |
---
|
|
|
6f7af4 |
modules.d/95iscsi/module-setup.sh | 11 +++++++++--
|
|
|
6f7af4 |
1 file changed, 9 insertions(+), 2 deletions(-)
|
|
|
6f7af4 |
|
|
|
6f7af4 |
diff --git a/modules.d/95iscsi/module-setup.sh b/modules.d/95iscsi/module-setup.sh
|
|
|
6f7af4 |
index 618d1dc2..5bb97df6 100755
|
|
|
6f7af4 |
--- a/modules.d/95iscsi/module-setup.sh
|
|
|
6f7af4 |
+++ b/modules.d/95iscsi/module-setup.sh
|
|
|
6f7af4 |
@@ -72,6 +72,7 @@ install_iscsiroot() {
|
|
|
6f7af4 |
local devpath=$1
|
|
|
6f7af4 |
local scsi_path iscsi_lun session c d conn host flash
|
|
|
6f7af4 |
local iscsi_session iscsi_address iscsi_port iscsi_targetname iscsi_tpgt
|
|
|
6f7af4 |
+ local bootproto
|
|
|
6f7af4 |
|
|
|
6f7af4 |
scsi_path=${devpath%%/block*}
|
|
|
6f7af4 |
[ "$scsi_path" = "$devpath" ] && return 1
|
|
|
6f7af4 |
@@ -120,8 +121,14 @@ install_iscsiroot() {
|
|
|
6f7af4 |
local_address=$(ip -o route get to $iscsi_address | sed -n 's/.*src \([0-9a-f.:]*\).*/\1/p')
|
|
|
6f7af4 |
ifname=$(ip -o route get to $iscsi_address | sed -n 's/.*dev \([^ ]*\).*/\1/p')
|
|
|
6f7af4 |
|
|
|
6f7af4 |
- #follow ifcfg settings for boot protocol
|
|
|
6f7af4 |
- bootproto=$(sed -n "/BOOTPROTO/s/BOOTPROTO='\([[:alpha:]]*6\?\)4\?'/\1/p" /etc/sysconfig/network/ifcfg-$ifname)
|
|
|
6f7af4 |
+ # follow ifcfg settings for boot protocol
|
|
|
6f7af4 |
+ for _path in \
|
|
|
6f7af4 |
+ "/etc/sysconfig/network-scripts/ifcfg-$ifname" \
|
|
|
6f7af4 |
+ "/etc/sysconfig/network/ifcfg-$ifname" \
|
|
|
6f7af4 |
+ ; do
|
|
|
6f7af4 |
+ [ -r "$_path" ] && bootproto=$(sed -n "s/BOOTPROTO='\?\([[:alpha:]]*6\?\)4\?/\1/p" "$_path")
|
|
|
6f7af4 |
+ done
|
|
|
6f7af4 |
+
|
|
|
6f7af4 |
if [ $bootproto ]; then
|
|
|
6f7af4 |
printf 'ip=%s:%s ' ${ifname} ${bootproto}
|
|
|
6f7af4 |
else
|
|
|
6f7af4 |
|