On 03/11/15 at 02:33pm, Dave Young wrote:
On 03/10/15 at 06:48pm, 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 4ac4c8f..8601933 100755
> --- a/dracut-module-setup.sh
> +++ b/dracut-module-setup.sh
> @@ -484,6 +484,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
> @@ -521,19 +522,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_address $tgt_ipaddr; then
> + netdev=$(/sbin/ip -6 route get to $(get_remote_host $tgt_ipaddr) | \
get_remote_host is used to remove like %eth0 at the end of the string.
tgt_ipaddr is returned by iscsiadm command, I guess it maybe already an ip addr
without %eth0, but I'm not sure, can you verify it? If it is true then this
section in the patch can be dropped.
I failed to setup the iscsi environment via ipv6 with scope link mode,
like ipv6 address: [fe80::5054:ff:fe0e:d5a7%eth1].
It is no harmful to use function get_remote_host to get the real ipv6
address.
Thanks
Minfei
> + sed 's|.*dev \(.*\).*|\1|g')
> + else
> + netdev=$(/sbin/ip route get to ${tgt_ipaddr} | \
> + sed 's|.*dev \(.*\).*|\1|g')
> + fi
> 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)
>
> # 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_address $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
> +
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
>
> --
> 1.9.3
>
> _______________________________________________
> kexec mailing list
> kexec(a)lists.fedoraproject.org
>
https://lists.fedoraproject.org/mailman/listinfo/kexec
>
>