On 06/13/15 at 02:51pm, Minfei Huang wrote:
Now the dracut does not have enough info to setup the ipv6 to
connect
the iscsi target in the 2nd kernel, if the iscsi connecting is ipv6
protocal.
For this patch, we will parse the iscsi connecting, pass the config to
the dracut to setup the ipv6 in the 2nd kernel.
Signed-off-by: Minfei Huang <mhuang(a)redhat.com>
---
dracut-module-setup.sh | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 615455e..8fd0cb8 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -526,6 +526,7 @@ kdump_get_iscsi_initiator() {
kdump_setup_iscsi_device() {
local path=$1
local tgt_name; local tgt_ipaddr;
+ local _srcaddr _prefix _netdev
local username; local password; local userpwd_str;
local username_in; local password_in; local userpwd_in_str;
local netdev
@@ -563,19 +564,33 @@ kdump_setup_iscsi_device() {
[ -n "$username_in" ] &&
userpwd_in_str=":$username_in:$password_in"
- netdev=$(/sbin/ip route get to ${tgt_ipaddr} | \
- sed 's|.*dev \(.*\).*|\1|g')
+ if is_ipv6_host $tgt_ipaddr; then
+ netdev=$(/sbin/ip -6 route get to $(get_remote_host $tgt_ipaddr) | \
+ sed 's|.*dev \(.*\).*|\1|g')
+ else
+ netdev=$(/sbin/ip route get to ${tgt_ipaddr} | \
+ sed 's|.*dev \(.*\).*|\1|g')
+ fi
I wonder if we can directly use "ip route get to" instead of specific
"-4" and "-6"
If it works then we do not need above chunk
srcaddr=$(echo $netdev | awk '{ print $3; exit }')
netdev=$(echo $netdev | awk '{ print $1; exit }')
- kdump_setup_netdev $netdev $srcaddr $tgt_ipaddr
+ kdump_setup_netdev $netdev $srcaddr $(get_remote_host $tgt_ipaddr)
tgt_ipaddr is retrieved via iscsiadm, the tool should take care of ipv4
and ipv6 logic, what is the return value of iscsiadm, should we do extra
parsing?
# prepare netroot= command line
- # FIXME: IPV6 addresses require explicit [] around $tgt_ipaddr
# FIXME: Do we need to parse and set other parameters like protocol, port
# iscsi_iface_name, netdev_name, LUN etc.
-
netroot_str="netroot=iscsi:${userpwd_str}${userpwd_in_str}@$tgt_ipaddr::::$tgt_name"
+ if is_ipv6_host $tgt_ipaddr; then
+ if `echo $tgt_ipaddr | grep -q "%"`; then
+ _prefix=${tgt_ipaddr%\%*}
+ _netdev=${tgt_ipaddr#*\%}
+ _netdev=$(kdump_setup_ifname $_netdev)
+ tgt_ipaddr=$_prefix%$_netdev
+ fi
Add prefix to an ipv6 address should be in a function, there's several places to use.
+
netroot_str="netroot=iscsi:${userpwd_str}${userpwd_in_str}@[$tgt_ipaddr]::::$tgt_name"
+ else
+
netroot_str="netroot=iscsi:${userpwd_str}${userpwd_in_str}@$tgt_ipaddr::::$tgt_name"
+ fi
[[ -f $netroot_conf ]] || touch $netroot_conf
Thanks
Dave