|
Harald Hoyer |
9d5d75 |
From 6f0500ed4afa29ae8edc997933d598bc5862b4ce Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
9d5d75 |
From: Harald Hoyer <harald@redhat.com>
|
|
Harald Hoyer |
9d5d75 |
Date: Mon, 13 Aug 2018 10:56:53 +0200
|
|
Harald Hoyer |
9d5d75 |
Subject: [PATCH] iscsi: remove $() where it does not fit
|
|
Harald Hoyer |
9d5d75 |
|
|
Harald Hoyer |
9d5d75 |
also simplify iscsiadm command to one call
|
|
Harald Hoyer |
9d5d75 |
---
|
|
Harald Hoyer |
9d5d75 |
modules.d/95iscsi/iscsiroot.sh | 33 ++++++++++++++++++---------------
|
|
Harald Hoyer |
9d5d75 |
1 file changed, 18 insertions(+), 15 deletions(-)
|
|
Harald Hoyer |
9d5d75 |
|
|
Harald Hoyer |
9d5d75 |
diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh
|
|
Harald Hoyer |
9d5d75 |
index 5ac0ad9a..76c8b3fe 100755
|
|
Harald Hoyer |
9d5d75 |
--- a/modules.d/95iscsi/iscsiroot.sh
|
|
Harald Hoyer |
9d5d75 |
+++ b/modules.d/95iscsi/iscsiroot.sh
|
|
Harald Hoyer |
9d5d75 |
@@ -109,7 +109,7 @@ handle_netroot()
|
|
Harald Hoyer |
9d5d75 |
arg=$(getarg rd.iscsi.in.password -d iscsi_in_password=)
|
|
Harald Hoyer |
9d5d75 |
[ -n "$arg" ] && iscsi_in_password=$arg
|
|
Harald Hoyer |
9d5d75 |
for p in $(getargs rd.iscsi.param -d iscsi_param); do
|
|
Harald Hoyer |
9d5d75 |
- iscsi_param="$iscsi_param $p"
|
|
Harald Hoyer |
9d5d75 |
+ iscsi_param="$iscsi_param $p"
|
|
Harald Hoyer |
9d5d75 |
done
|
|
Harald Hoyer |
9d5d75 |
|
|
Harald Hoyer |
9d5d75 |
parse_iscsi_root "$1" || return 1
|
|
Harald Hoyer |
9d5d75 |
@@ -208,28 +208,31 @@ handle_netroot()
|
|
Harald Hoyer |
9d5d75 |
echo "iscsi_lun=$iscsi_lun . /bin/mount-lun.sh " > $hookdir/mount/01-$$-iscsi.sh
|
|
Harald Hoyer |
9d5d75 |
fi
|
|
Harald Hoyer |
9d5d75 |
|
|
Harald Hoyer |
9d5d75 |
- ### ToDo: Upstream calls systemd-run - Shall we, do we have to port this?
|
|
Harald Hoyer |
9d5d75 |
-
|
|
Harald Hoyer |
9d5d75 |
targets=$(iscsiadm -m discovery -t st -p $iscsi_target_ip:${iscsi_target_port:+$iscsi_target_port} | sed 's/^.*iqn/iqn/')
|
|
Harald Hoyer |
9d5d75 |
[ -z "$targets" ] && echo "Target discovery to $iscsi_target_ip:${iscsi_target_port:+$iscsi_target_port} failed with status $?" && exit 1
|
|
Harald Hoyer |
9d5d75 |
|
|
Harald Hoyer |
9d5d75 |
for target in $iscsi_target_name; do
|
|
Harald Hoyer |
9d5d75 |
case "$targets" in
|
|
Harald Hoyer |
9d5d75 |
*$target*)
|
|
Harald Hoyer |
9d5d75 |
+ EXTRA=""
|
|
Harald Hoyer |
9d5d75 |
if [ -n "$iscsi_iface_name" ]; then
|
|
Harald Hoyer |
9d5d75 |
- $(iscsiadm -m iface -I $iscsi_iface_name --op=new)
|
|
Harald Hoyer |
9d5d75 |
- [ -n "$iscsi_initiator" ] && $(iscsiadm -m iface -I $iscsi_iface_name --op=update --name=iface.initiatorname --value=$iscsi_initiator)
|
|
Harald Hoyer |
9d5d75 |
- [ -n "$iscsi_netdev_name" ] && $(iscsiadm -m iface -I $iscsi_iface_name --op=update --name=iface.net_ifacename --value=$iscsi_netdev_name)
|
|
Harald Hoyer |
9d5d75 |
- COMMAND="iscsiadm -m node -T $target -p $iscsi_target_ip${iscsi_target_port:+:$iscsi_target_port} -I $iscsi_iface_name --op=update"
|
|
Harald Hoyer |
9d5d75 |
- else
|
|
Harald Hoyer |
9d5d75 |
- COMMAND="iscsiadm -m node -T $target -p $iscsi_target_ip${iscsi_target_port:+:$iscsi_target_port} --op=update"
|
|
Harald Hoyer |
9d5d75 |
+ iscsiadm -m iface -I $iscsi_iface_name --op=new
|
|
Harald Hoyer |
9d5d75 |
+ EXTRA=" ${iscsi_netdev_name:+--name=iface.net_ifacename --value=$iscsi_netdev_name} "
|
|
Harald Hoyer |
9d5d75 |
+ EXTRA="$EXTRA ${iscsi_initiator:+--name=iface.initiatorname --value=$iscsi_initiator} "
|
|
Harald Hoyer |
9d5d75 |
fi
|
|
Harald Hoyer |
9d5d75 |
- $($COMMAND --name=node.startup --value=onboot)
|
|
Harald Hoyer |
9d5d75 |
- [ -n "$iscsi_username" ] && $($COMMAND --name=node.session.auth.username --value=$iscsi_username)
|
|
Harald Hoyer |
9d5d75 |
- [ -n "$iscsi_password" ] && $($COMMAND --name=node.session.auth.password --value=$iscsi_password)
|
|
Harald Hoyer |
9d5d75 |
- [ -n "$iscsi_in_username" ] && $($COMMAND --name=node.session.auth.username_in --value=$iscsi_in_username)
|
|
Harald Hoyer |
9d5d75 |
- [ -n "$iscsi_in_password" ] && $($COMMAND --name=node.session.auth.password_in --value=$iscsi_in_password)
|
|
Harald Hoyer |
9d5d75 |
- [ -n "$iscsi_param" ] && for param in $iscsi_param; do $($COMMAND --name=${param%=*} --value=${param#*=}); done
|
|
Harald Hoyer |
9d5d75 |
+ [ -n "$iscsi_param" ] && for param in $iscsi_param; do EXTRA="$EXTRA --name=${param%=*} --value=${param#*=}"; done
|
|
Harald Hoyer |
9d5d75 |
+
|
|
Harald Hoyer |
9d5d75 |
+ iscsiadm -m node -T $target \
|
|
Harald Hoyer |
9d5d75 |
+ ${iscsi_iface_name:+-I $iscsi_iface_name} \
|
|
Harald Hoyer |
9d5d75 |
+ -p $iscsi_target_ip${iscsi_target_port:+:$iscsi_target_port} \
|
|
Harald Hoyer |
9d5d75 |
+ --op=update \
|
|
Harald Hoyer |
9d5d75 |
+ --name=node.startup --value=onboot \
|
|
Harald Hoyer |
9d5d75 |
+ ${iscsi_username:+ --name=node.session.auth.username --value=$iscsi_username} \
|
|
Harald Hoyer |
9d5d75 |
+ ${iscsi_password:+ --name=node.session.auth.password --value=$iscsi_password} \
|
|
Harald Hoyer |
9d5d75 |
+ ${iscsi_in_username:+--name=node.session.auth.username_in --value=$iscsi_in_username} \
|
|
Harald Hoyer |
9d5d75 |
+ ${iscsi_in_password:+--name=node.session.auth.password_in --value=$iscsi_in_password} \
|
|
Harald Hoyer |
9d5d75 |
+ $EXTRA \
|
|
Harald Hoyer |
9d5d75 |
+ $NULL
|
|
Harald Hoyer |
9d5d75 |
;;
|
|
Harald Hoyer |
9d5d75 |
*)
|
|
Harald Hoyer |
9d5d75 |
;;
|
|
Harald Hoyer |
9d5d75 |
|