Resolves: bz821620
Description: Currently kdump doesn't support ipv6 nfs/ssh dump. Ipv6 is the latest version of the Internet Protocal. so it is a significant feture for kdump to enhance to support ipv6.
Solutions: Since dracut has supported ipv6 now, it is easy to change the kdump code to support ipv6. Just need pass the right _ip_opts to the second kernle. What is the main difference in userspace bettwen ipv4 and ipv6 is the ip address format. For ipv6 nfs dump: if ipv6 address type is link scope, /etc/kdump.conf should be edited like "nfs [fe80::5054:ff:fe48:ca80%eth0]:/mnt" else /etc/kdump.conf should be edited like "nfs [2001:db8:0:f101::2]:/mnt" For ipv6 ssh dump if ipv6 address type is link scope, /etc/kdump.conf should be edited like "ssh root@fe80::5054:ff:fe48:ca80%eth0" else /etc/kdump.conf should be edited like "ssh root@2001:db8:0:f101::2"
What this patch do is: a): Add a function is_ipv6_target to tell what version of Internet Protocal (ipv4/ipv6) kdump will use to dump to remote target. b): Modify kdump_install_net to handle ipv6 configuration in /etc/kdump.conf correctly. Get the ipv6 address from /etc/kdump.conf is more complicated than ipv4 because the difference configuration format mentioned above. c): Based on the ip address type, using corresponding ip address as HOST_IP in second kernel.
It was tested for IPV6 and IPV4 address in beaker machine https://beaker.engineering .redhat.com/jobs/675666(client) and https://beaker.engineering.redhat.com/jobs/674574 (server) and passed
Note: Currntly only f19 support remount a nfs target in ipv6. detail in https: //bugzilla.redhat.com/show_bug.cgi?id=1099761
Signed-off-by: Arthur Zou zzou@redhat.com --- dracut-kdump.sh | 9 +++++++-- dracut-module-setup.sh | 47 +++++++++++++++++++++++++++++++---------------- kdump-lib.sh | 23 +++++++++++++++++++++++ 3 files changed, 61 insertions(+), 18 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh index cb13d92..5dcd8a4 100755 --- a/dracut-kdump.sh +++ b/dracut-kdump.sh @@ -206,9 +206,14 @@ get_host_ip() then kdumpnic=$(getarg kdumpnic=) [ -z "$kdumpnic" ] && echo "kdump: failed to get kdumpnic!" && return 1 - _host=`ip addr show dev $kdumpnic|grep 'inet '` + if is_ipv6_target + then + _host=`ip addr show dev $kdumpnic|grep 'inet6'` + else + _host=`ip addr show dev $kdumpnic|grep 'inet '` + fi [ $? -ne 0 ] && echo "kdump: wrong kdumpnic: $kdumpnic" && return 1 - _host="${_host##*inet }" + _host=`echo $_host | cut -d' ' -f2` _host="${_host%%/*}" [ -z "$_host" ] && echo "kdump: wrong kdumpnic: $kdumpnic" && return 1 HOST_IP=$_host diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 2a16900..c13ed18 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -64,6 +64,7 @@ kdump_setup_dns() { . /etc/sysconfig/network-scripts/ifcfg-$1 [ -n "$DNS1" ] && echo "nameserver=$DNS1" > "$_dnsfile" [ -n "$DNS2" ] && echo "nameserver=$DNS2" >> "$_dnsfile" + [ -f /etc/resolv.conf ] && cat /etc/resolv.conf >> "$_dnsfile" }
#$1: netdev name @@ -71,10 +72,20 @@ kdump_setup_dns() { #if it use static ip echo it, or echo null kdump_static_ip() { . /etc/sysconfig/network-scripts/ifcfg-$1 - if [ -n "$IPADDR" ]; then - [ -z "$NETMASK" -a -n "$PREFIX" ] && \ + if is_ipv6_target + then + if [ -n "$IPV6ADDR" ]; then + IPV6ADDR=${IPV6ADDR%/*} #strip the surfix + IPV6ADDR="[${IPV6ADDR}]" + IPV6_DEFAULTGW="[${IPV6_DEFAULTGW}]" + echo -n "${IPV6ADDR}::${IPV6_DEFAULTGW}:64::" + fi + else + if [ -n "$IPADDR" ]; then + [ -z "$NETMASK" -a -n "$PREFIX" ] && \ NETMASK=$(ipcalc -m $IPADDR/$PREFIX | cut -d'=' -f2) - echo -n "${IPADDR}::${GATEWAY}:${NETMASK}::" + echo -n "${IPADDR}::${GATEWAY}:${NETMASK}::" + fi fi }
@@ -227,24 +238,26 @@ kdump_install_net() { local _server _netdev local config_val="$1"
- _server=`echo $config_val | sed 's/.*@//' | cut -d':' -f1` - - _need_dns=`echo $_server|grep "[a-zA-Z]"` - [ -n "$_need_dns" ] && _server=`getent hosts $_server|cut -d' ' -f1` + _server=`echo $config_val | sed 's/.*@//'` + _server=${_server%:/*} + _server=${_server#[} + _server=${_server%]} + _server=${_server%%*} #strip the zone_ID if exist
- _netdev=`/sbin/ip route get to $_server 2>&1` - [ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1 - - #the field in the ip output changes if we go to another subnet - if [ -n "`echo $_netdev | grep via`" ] + if is_ipv6_target then - # we are going to a different subnet - _netdev=`echo $_netdev|awk '{print $5;}'|head -n 1` + _need_dns=`echo $_server|grep "[:]"` + [ -z "$_need_dns" ] && _server=`getent hosts $_server| head -n 1 | cut -d' ' -f1` else - # we are on the same subnet - _netdev=`echo $_netdev|awk '{print $3}'|head -n 1` + _need_dns=`echo $_server|grep "[a-zA-Z]"` + [ -n "$_need_dns" ] && _server=`getent hosts $_server| head -n 1 | cut -d' ' -f1` fi
+ _netdev=`/sbin/ip route get to $_server 2>&1` + [ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1 + _netdev=${_netdev#*dev} + _netdev=`echo $_netdev | cut -d' ' -f1 ` + kdump_setup_netdev "${_netdev}"
#save netdev used for kdump as cmdline @@ -542,6 +555,8 @@ install() { inst "/bin/date" "/bin/date" inst "/bin/sync" "/bin/sync" inst "/bin/cut" "/bin/cut" + inst "/bin/getent" "/bin/getent" + inst "/bin/head" "/bin/head" inst "/sbin/makedumpfile" "/sbin/makedumpfile" inst "/sbin/vmcore-dmesg" "/sbin/vmcore-dmesg" inst_hook pre-pivot 9999 "$moddir/kdump.sh" diff --git a/kdump-lib.sh b/kdump-lib.sh index a20c6e8..5e9f973 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -44,6 +44,29 @@ strip_comments() echo $@ | sed -e 's/(.*)#.*/\1/' }
+# check the remote server ip address tpye +is_ipv6_target() +{ + local _server _server_tmp + if is_ssh_dump_target; then + _server=`grep "^ssh " /etc/kdump.conf` + elif is_nfs_dump_target; then + _server=`grep "^nfs " /etc/kdump.conf` + fi + + [ -z "$_server" ] && return 1 + _server=`strip_comments $_server` + _server=${_server#*@} + _server=${_server%:/*} + _server=${_server#[} + _server=${_server%]} + _server=${_server%%*} + _server_tmp=$_server + _server=`getent hosts $_server | head -n 1 | cut -d' ' -f1` + _server=${_server:-$_server_tmp} + echo $_server | grep -q ":" +} + # Check if fence kdump is configured in Pacemaker cluster is_pcs_fence_kdump() {
On 06/20/14 at 05:41pm, Zhi Zou wrote:
Resolves: bz821620
Description: Currently kdump doesn't support ipv6 nfs/ssh dump. Ipv6 is the latest version of the Internet Protocal. so it is a significant feture for kdump to enhance to support ipv6.
Solutions: Since dracut has supported ipv6 now, it is easy to change the kdump code to support ipv6. Just need pass the right _ip_opts to the second kernle. What is the main difference in userspace bettwen ipv4 and ipv6 is the ip address format. For ipv6 nfs dump: if ipv6 address type is link scope, /etc/kdump.conf should be edited like "nfs [fe80::5054:ff:fe48:ca80%eth0]:/mnt" else /etc/kdump.conf should be edited like "nfs [2001:db8:0:f101::2]:/mnt" For ipv6 ssh dump if ipv6 address type is link scope, /etc/kdump.conf should be edited like "ssh root@fe80::5054:ff:fe48:ca80%eth0" else /etc/kdump.conf should be edited like "ssh root@2001:db8:0:f101::2"
What this patch do is: a): Add a function is_ipv6_target to tell what version of Internet Protocal (ipv4/ipv6) kdump will use to dump to remote target. b): Modify kdump_install_net to handle ipv6 configuration in /etc/kdump.conf correctly. Get the ipv6 address from /etc/kdump.conf is more complicated than ipv4 because the difference configuration format mentioned above. c): Based on the ip address type, using corresponding ip address as HOST_IP in second kernel.
Hi, Arthur
Thanks for this work. I have a few comments in line.
It was tested for IPV6 and IPV4 address in beaker machine https://beaker.engineering .redhat.com/jobs/675666(client) and https://beaker.engineering.redhat.com/jobs/674574 (server) and passed
Note: Currntly only f19 support remount a nfs target in ipv6. detail in https: //bugzilla.redhat.com/show_bug.cgi?id=1099761
Signed-off-by: Arthur Zou zzou@redhat.com
dracut-kdump.sh | 9 +++++++-- dracut-module-setup.sh | 47 +++++++++++++++++++++++++++++++---------------- kdump-lib.sh | 23 +++++++++++++++++++++++ 3 files changed, 61 insertions(+), 18 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh index cb13d92..5dcd8a4 100755 --- a/dracut-kdump.sh +++ b/dracut-kdump.sh @@ -206,9 +206,14 @@ get_host_ip() then kdumpnic=$(getarg kdumpnic=) [ -z "$kdumpnic" ] && echo "kdump: failed to get kdumpnic!" && return 1
_host=`ip addr show dev $kdumpnic|grep 'inet '`
if is_ipv6_target
then
_host=`ip addr show dev $kdumpnic|grep 'inet6'`
else
_host=`ip addr show dev $kdumpnic|grep 'inet '`
fi [ $? -ne 0 ] && echo "kdump: wrong kdumpnic: $kdumpnic" && return 1
_host="${_host##*inet }"
_host=`echo $_host | cut -d' ' -f2` _host="${_host%%/*}" [ -z "$_host" ] && echo "kdump: wrong kdumpnic: $kdumpnic" && return 1 HOST_IP=$_host
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 2a16900..c13ed18 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -64,6 +64,7 @@ kdump_setup_dns() { . /etc/sysconfig/network-scripts/ifcfg-$1 [ -n "$DNS1" ] && echo "nameserver=$DNS1" > "$_dnsfile" [ -n "$DNS2" ] && echo "nameserver=$DNS2" >> "$_dnsfile"
- [ -f /etc/resolv.conf ] && cat /etc/resolv.conf >> "$_dnsfile"
resolv.conf is generated on the fly, it's not persistent way to store dns server configuration.
Either user put a DNS1/DNS2 directive in ifcfg or dhcp will automatically get one, and in both ways, resolv.conf will be overridden from last boot.
}
#$1: netdev name @@ -71,10 +72,20 @@ kdump_setup_dns() { #if it use static ip echo it, or echo null kdump_static_ip() { . /etc/sysconfig/network-scripts/ifcfg-$1
- if [ -n "$IPADDR" ]; then
[ -z "$NETMASK" -a -n "$PREFIX" ] && \
- if is_ipv6_target
- then
if [ -n "$IPV6ADDR" ]; then
IPV6ADDR=${IPV6ADDR%/*} #strip the surfix
s/surfix/suffix/
Could you put the comment above this line please? I think it'd look better.
What's is this stripping for? How IPV6ADDR is formed and what is its suffix?
IPV6ADDR="[${IPV6ADDR}]"
IPV6_DEFAULTGW="[${IPV6_DEFAULTGW}]"
echo -n "${IPV6ADDR}::${IPV6_DEFAULTGW}:64::"
fi
- else
if [ -n "$IPADDR" ]; then
[ -z "$NETMASK" -a -n "$PREFIX" ] && \ NETMASK=$(ipcalc -m $IPADDR/$PREFIX | cut -d'=' -f2)
echo -n "${IPADDR}::${GATEWAY}:${NETMASK}::"
echo -n "${IPADDR}::${GATEWAY}:${NETMASK}::"
fifi
}
@@ -227,24 +238,26 @@ kdump_install_net() { local _server _netdev local config_val="$1"
- _server=`echo $config_val | sed 's/.*@//' | cut -d':' -f1`
- _need_dns=`echo $_server|grep "[a-zA-Z]"`
- [ -n "$_need_dns" ] && _server=`getent hosts $_server|cut -d' ' -f1`
- _server=`echo $config_val | sed 's/.*@//'`
- _server=${_server%:/*}
- _server=${_server#[}
- _server=${_server%]}
- _server=${_server%%*} #strip the zone_ID if exist
Put the comment up above.
- _netdev=`/sbin/ip route get to $_server 2>&1`
- [ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1
- #the field in the ip output changes if we go to another subnet
- if [ -n "`echo $_netdev | grep via`" ]
- if is_ipv6_target then
# we are going to a different subnet
_netdev=`echo $_netdev|awk '{print $5;}'|head -n 1`
_need_dns=`echo $_server|grep "[:]"`
else[ -z "$_need_dns" ] && _server=`getent hosts $_server| head -n 1 | cut -d' ' -f1`
# we are on the same subnet
_netdev=`echo $_netdev|awk '{print $3}'|head -n 1`
_need_dns=`echo $_server|grep "[a-zA-Z]"`
[ -n "$_need_dns" ] && _server=`getent hosts $_server| head -n 1 | cut -d' ' -f1`
fi
_netdev=`/sbin/ip route get to $_server 2>&1`
[ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1
_netdev=${_netdev#*dev}
_netdev=`echo $_netdev | cut -d' ' -f1 `
I'm not quite understand this part. You deleted some comments and if-else code block of subnet path. I think it's better to add a few comments what you're doing here.
For the logic in there, Bao/Marc, I'll leave it to you guys, since you're proved to be the experts from the static routes issue.
kdump_setup_netdev "${_netdev}"
#save netdev used for kdump as cmdline
@@ -542,6 +555,8 @@ install() { inst "/bin/date" "/bin/date" inst "/bin/sync" "/bin/sync" inst "/bin/cut" "/bin/cut"
- inst "/bin/getent" "/bin/getent"
- inst "/bin/head" "/bin/head" inst "/sbin/makedumpfile" "/sbin/makedumpfile" inst "/sbin/vmcore-dmesg" "/sbin/vmcore-dmesg" inst_hook pre-pivot 9999 "$moddir/kdump.sh"
diff --git a/kdump-lib.sh b/kdump-lib.sh index a20c6e8..5e9f973 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -44,6 +44,29 @@ strip_comments() echo $@ | sed -e 's/(.*)#.*/\1/' }
+# check the remote server ip address tpye +is_ipv6_target() +{
- local _server _server_tmp
You might want to put an extra new line after variable declaration.
- if is_ssh_dump_target; then
_server=`grep "^ssh " /etc/kdump.conf`
- elif is_nfs_dump_target; then
_server=`grep "^nfs " /etc/kdump.conf`
- fi
- [ -z "$_server" ] && return 1
- _server=`strip_comments $_server`
Actually we have a function get_option_value(), that might be helpful. But I guess get_option_value() can be improved, you might want to modify it for you own sake.
- _server=${_server#*@}
- _server=${_server%:/*}
- _server=${_server#[}
- _server=${_server%]}
- _server=${_server%%*}
- _server_tmp=$_server
- _server=`getent hosts $_server | head -n 1 | cut -d' ' -f1`
- _server=${_server:-$_server_tmp}
- echo $_server | grep -q ":"
Please put a bit of comment up there. It's not really comprehensive.
Also this several line seems pretty like what you did in kdump_install_net(). Could you find a way to extract these lines to a function?
Thanks WANG Chao
+}
# Check if fence kdump is configured in Pacemaker cluster is_pcs_fence_kdump() { -- 1.8.4.2
On 06/25/14 at 04:06pm, WANG Chao wrote:
On 06/20/14 at 05:41pm, Zhi Zou wrote:
Resolves: bz821620
Description: Currently kdump doesn't support ipv6 nfs/ssh dump. Ipv6 is the latest version of the Internet Protocal. so it is a significant feture for kdump to enhance to support ipv6.
Solutions: Since dracut has supported ipv6 now, it is easy to change the kdump code to support ipv6. Just need pass the right _ip_opts to the second kernle. What is the main difference in userspace bettwen ipv4 and ipv6 is the ip address format. For ipv6 nfs dump: if ipv6 address type is link scope, /etc/kdump.conf should be edited like "nfs [fe80::5054:ff:fe48:ca80%eth0]:/mnt" else /etc/kdump.conf should be edited like "nfs [2001:db8:0:f101::2]:/mnt" For ipv6 ssh dump if ipv6 address type is link scope, /etc/kdump.conf should be edited like "ssh root@fe80::5054:ff:fe48:ca80%eth0" else /etc/kdump.conf should be edited like "ssh root@2001:db8:0:f101::2"
What this patch do is: a): Add a function is_ipv6_target to tell what version of Internet Protocal (ipv4/ipv6) kdump will use to dump to remote target. b): Modify kdump_install_net to handle ipv6 configuration in /etc/kdump.conf correctly. Get the ipv6 address from /etc/kdump.conf is more complicated than ipv4 because the difference configuration format mentioned above. c): Based on the ip address type, using corresponding ip address as HOST_IP in second kernel.
Hi, Arthur
Thanks for this work. I have a few comments in line.
It was tested for IPV6 and IPV4 address in beaker machine https://beaker.engineering .redhat.com/jobs/675666(client) and https://beaker.engineering.redhat.com/jobs/674574 (server) and passed
Note: Currntly only f19 support remount a nfs target in ipv6. detail in https: //bugzilla.redhat.com/show_bug.cgi?id=1099761
Signed-off-by: Arthur Zou zzou@redhat.com
dracut-kdump.sh | 9 +++++++-- dracut-module-setup.sh | 47 +++++++++++++++++++++++++++++++---------------- kdump-lib.sh | 23 +++++++++++++++++++++++ 3 files changed, 61 insertions(+), 18 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh index cb13d92..5dcd8a4 100755 --- a/dracut-kdump.sh +++ b/dracut-kdump.sh @@ -206,9 +206,14 @@ get_host_ip() then kdumpnic=$(getarg kdumpnic=) [ -z "$kdumpnic" ] && echo "kdump: failed to get kdumpnic!" && return 1
_host=`ip addr show dev $kdumpnic|grep 'inet '`
if is_ipv6_target
then
_host=`ip addr show dev $kdumpnic|grep 'inet6'`
else
_host=`ip addr show dev $kdumpnic|grep 'inet '`
fi [ $? -ne 0 ] && echo "kdump: wrong kdumpnic: $kdumpnic" && return 1
_host="${_host##*inet }"
_host=`echo $_host | cut -d' ' -f2` _host="${_host%%/*}" [ -z "$_host" ] && echo "kdump: wrong kdumpnic: $kdumpnic" && return 1 HOST_IP=$_host
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 2a16900..c13ed18 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -64,6 +64,7 @@ kdump_setup_dns() { . /etc/sysconfig/network-scripts/ifcfg-$1 [ -n "$DNS1" ] && echo "nameserver=$DNS1" > "$_dnsfile" [ -n "$DNS2" ] && echo "nameserver=$DNS2" >> "$_dnsfile"
- [ -f /etc/resolv.conf ] && cat /etc/resolv.conf >> "$_dnsfile"
resolv.conf is generated on the fly, it's not persistent way to store dns server configuration.
Either user put a DNS1/DNS2 directive in ifcfg or dhcp will automatically get one, and in both ways, resolv.conf will be overridden from last boot.
I will remove this line if we don't support configuring dns in /etc/resolv.conf manully.
}
#$1: netdev name @@ -71,10 +72,20 @@ kdump_setup_dns() { #if it use static ip echo it, or echo null kdump_static_ip() { . /etc/sysconfig/network-scripts/ifcfg-$1
- if [ -n "$IPADDR" ]; then
[ -z "$NETMASK" -a -n "$PREFIX" ] && \
- if is_ipv6_target
- then
if [ -n "$IPV6ADDR" ]; then
IPV6ADDR=${IPV6ADDR%/*} #strip the surfix
s/surfix/suffix/
Could you put the comment above this line please? I think it'd look better.
What's is this stripping for? How IPV6ADDR is formed and what is its suffix?
Ok, I will put some comment in there. the format of IPV6ADDR in ifcfg-$1 is like xxxx:xxxx::xxxx/64. the string before '/' is the ipv6 address and the 64 is the length of network address. It is similar with 202.204.105.8/24. Since ipv6 don't support netmask, so this is the only way to specify the network address and host address.
IPV6ADDR="[${IPV6ADDR}]"
IPV6_DEFAULTGW="[${IPV6_DEFAULTGW}]"
echo -n "${IPV6ADDR}::${IPV6_DEFAULTGW}:64::"
fi
- else
if [ -n "$IPADDR" ]; then
[ -z "$NETMASK" -a -n "$PREFIX" ] && \ NETMASK=$(ipcalc -m $IPADDR/$PREFIX | cut -d'=' -f2)
echo -n "${IPADDR}::${GATEWAY}:${NETMASK}::"
echo -n "${IPADDR}::${GATEWAY}:${NETMASK}::"
fifi
}
@@ -227,24 +238,26 @@ kdump_install_net() { local _server _netdev local config_val="$1"
- _server=`echo $config_val | sed 's/.*@//' | cut -d':' -f1`
- _need_dns=`echo $_server|grep "[a-zA-Z]"`
- [ -n "$_need_dns" ] && _server=`getent hosts $_server|cut -d' ' -f1`
- _server=`echo $config_val | sed 's/.*@//'`
- _server=${_server%:/*}
- _server=${_server#[}
- _server=${_server%]}
- _server=${_server%%*} #strip the zone_ID if exist
Put the comment up above.
- _netdev=`/sbin/ip route get to $_server 2>&1`
- [ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1
- #the field in the ip output changes if we go to another subnet
- if [ -n "`echo $_netdev | grep via`" ]
- if is_ipv6_target then
# we are going to a different subnet
_netdev=`echo $_netdev|awk '{print $5;}'|head -n 1`
_need_dns=`echo $_server|grep "[:]"`
else[ -z "$_need_dns" ] && _server=`getent hosts $_server| head -n 1 | cut -d' ' -f1`
# we are on the same subnet
_netdev=`echo $_netdev|awk '{print $3}'|head -n 1`
_need_dns=`echo $_server|grep "[a-zA-Z]"`
[ -n "$_need_dns" ] && _server=`getent hosts $_server| head -n 1 | cut -d' ' -f1`
fi
_netdev=`/sbin/ip route get to $_server 2>&1`
[ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1
_netdev=${_netdev#*dev}
_netdev=`echo $_netdev | cut -d' ' -f1 `
I'm not quite understand this part. You deleted some comments and if-else code block of subnet path. I think it's better to add a few comments what you're doing here.
For the logic in there, Bao/Marc, I'll leave it to you guys, since you're proved to be the experts from the static routes issue.
kdump_setup_netdev "${_netdev}"
#save netdev used for kdump as cmdline
@@ -542,6 +555,8 @@ install() { inst "/bin/date" "/bin/date" inst "/bin/sync" "/bin/sync" inst "/bin/cut" "/bin/cut"
- inst "/bin/getent" "/bin/getent"
- inst "/bin/head" "/bin/head" inst "/sbin/makedumpfile" "/sbin/makedumpfile" inst "/sbin/vmcore-dmesg" "/sbin/vmcore-dmesg" inst_hook pre-pivot 9999 "$moddir/kdump.sh"
diff --git a/kdump-lib.sh b/kdump-lib.sh index a20c6e8..5e9f973 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -44,6 +44,29 @@ strip_comments() echo $@ | sed -e 's/(.*)#.*/\1/' }
+# check the remote server ip address tpye +is_ipv6_target() +{
- local _server _server_tmp
You might want to put an extra new line after variable declaration.
Ok, that's helpful.
- if is_ssh_dump_target; then
_server=`grep "^ssh " /etc/kdump.conf`
- elif is_nfs_dump_target; then
_server=`grep "^nfs " /etc/kdump.conf`
- fi
- [ -z "$_server" ] && return 1
- _server=`strip_comments $_server`
Actually we have a function get_option_value(), that might be helpful. But I guess get_option_value() can be improved, you might want to modify it for you own sake.
It's a good suggestion. I'll try later.
- _server=${_server#*@}
- _server=${_server%:/*}
- _server=${_server#[}
- _server=${_server%]}
- _server=${_server%%*}
- _server_tmp=$_server
- _server=`getent hosts $_server | head -n 1 | cut -d' ' -f1`
- _server=${_server:-$_server_tmp}
- echo $_server | grep -q ":"
Please put a bit of comment up there. It's not really comprehensive.
Also this several line seems pretty like what you did in kdump_install_net(). Could you find a way to extract these lines to a function?
Thanks WANG Chao
+}
# Check if fence kdump is configured in Pacemaker cluster is_pcs_fence_kdump() { -- 1.8.4.2
On 06/20/14 at 05:41pm, Arthur Zou wrote:
Resolves: bz821620
Description: Currently kdump doesn't support ipv6 nfs/ssh dump. Ipv6 is the latest version of the Internet Protocal. so it is a significant feture for kdump to enhance to support ipv6.
Solutions: Since dracut has supported ipv6 now, it is easy to change the kdump code to support ipv6. Just need pass the right _ip_opts to the second kernle. What is the main difference in userspace bettwen ipv4 and ipv6 is the ip address format. For ipv6 nfs dump: if ipv6 address type is link scope, /etc/kdump.conf should be edited like "nfs [fe80::5054:ff:fe48:ca80%eth0]:/mnt" else /etc/kdump.conf should be edited like "nfs [2001:db8:0:f101::2]:/mnt" For ipv6 ssh dump if ipv6 address type is link scope, /etc/kdump.conf should be edited like "ssh root@fe80::5054:ff:fe48:ca80%eth0" else /etc/kdump.conf should be edited like "ssh root@2001:db8:0:f101::2"
What this patch do is: a): Add a function is_ipv6_target to tell what version of Internet Protocal (ipv4/ipv6) kdump will use to dump to remote target. b): Modify kdump_install_net to handle ipv6 configuration in /etc/kdump.conf correctly. Get the ipv6 address from /etc/kdump.conf is more complicated than ipv4 because the difference configuration format mentioned above. c): Based on the ip address type, using corresponding ip address as HOST_IP in second kernel.
It was tested for IPV6 and IPV4 address in beaker machine https://beaker.engineering .redhat.com/jobs/675666(client) and https://beaker.engineering.redhat.com/jobs/674574 (server) and passed
Note: Currntly only f19 support remount a nfs target in ipv6. detail in https: //bugzilla.redhat.com/show_bug.cgi?id=1099761
It seems can not apply to latest kexec-tools. Arthur, could you address comments from Chao and rebase to latest repo?
Signed-off-by: Arthur Zou zzou@redhat.com
dracut-kdump.sh | 9 +++++++-- dracut-module-setup.sh | 47 +++++++++++++++++++++++++++++++---------------- kdump-lib.sh | 23 +++++++++++++++++++++++ 3 files changed, 61 insertions(+), 18 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh index cb13d92..5dcd8a4 100755 --- a/dracut-kdump.sh +++ b/dracut-kdump.sh @@ -206,9 +206,14 @@ get_host_ip() then kdumpnic=$(getarg kdumpnic=) [ -z "$kdumpnic" ] && echo "kdump: failed to get kdumpnic!" && return 1
_host=`ip addr show dev $kdumpnic|grep 'inet '`
if is_ipv6_target
then
_host=`ip addr show dev $kdumpnic|grep 'inet6'`
else
_host=`ip addr show dev $kdumpnic|grep 'inet '`
fi [ $? -ne 0 ] && echo "kdump: wrong kdumpnic: $kdumpnic" && return 1
_host="${_host##*inet }"
_host=`echo $_host | cut -d' ' -f2` _host="${_host%%/*}" [ -z "$_host" ] && echo "kdump: wrong kdumpnic: $kdumpnic" && return 1 HOST_IP=$_host
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 2a16900..c13ed18 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -64,6 +64,7 @@ kdump_setup_dns() { . /etc/sysconfig/network-scripts/ifcfg-$1 [ -n "$DNS1" ] && echo "nameserver=$DNS1" > "$_dnsfile" [ -n "$DNS2" ] && echo "nameserver=$DNS2" >> "$_dnsfile"
- [ -f /etc/resolv.conf ] && cat /etc/resolv.conf >> "$_dnsfile"
}
#$1: netdev name @@ -71,10 +72,20 @@ kdump_setup_dns() { #if it use static ip echo it, or echo null kdump_static_ip() { . /etc/sysconfig/network-scripts/ifcfg-$1
- if [ -n "$IPADDR" ]; then
[ -z "$NETMASK" -a -n "$PREFIX" ] && \
- if is_ipv6_target
- then
if [ -n "$IPV6ADDR" ]; then
IPV6ADDR=${IPV6ADDR%/*} #strip the surfix
IPV6ADDR="[${IPV6ADDR}]"
IPV6_DEFAULTGW="[${IPV6_DEFAULTGW}]"
echo -n "${IPV6ADDR}::${IPV6_DEFAULTGW}:64::"
fi
- else
if [ -n "$IPADDR" ]; then
[ -z "$NETMASK" -a -n "$PREFIX" ] && \ NETMASK=$(ipcalc -m $IPADDR/$PREFIX | cut -d'=' -f2)
echo -n "${IPADDR}::${GATEWAY}:${NETMASK}::"
echo -n "${IPADDR}::${GATEWAY}:${NETMASK}::"
fifi
}
@@ -227,24 +238,26 @@ kdump_install_net() { local _server _netdev local config_val="$1"
- _server=`echo $config_val | sed 's/.*@//' | cut -d':' -f1`
- _need_dns=`echo $_server|grep "[a-zA-Z]"`
- [ -n "$_need_dns" ] && _server=`getent hosts $_server|cut -d' ' -f1`
- _server=`echo $config_val | sed 's/.*@//'`
- _server=${_server%:/*}
- _server=${_server#[}
- _server=${_server%]}
- _server=${_server%%*} #strip the zone_ID if exist
- _netdev=`/sbin/ip route get to $_server 2>&1`
- [ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1
- #the field in the ip output changes if we go to another subnet
- if [ -n "`echo $_netdev | grep via`" ]
- if is_ipv6_target then
# we are going to a different subnet
_netdev=`echo $_netdev|awk '{print $5;}'|head -n 1`
_need_dns=`echo $_server|grep "[:]"`
else[ -z "$_need_dns" ] && _server=`getent hosts $_server| head -n 1 | cut -d' ' -f1`
# we are on the same subnet
_netdev=`echo $_netdev|awk '{print $3}'|head -n 1`
_need_dns=`echo $_server|grep "[a-zA-Z]"`
[ -n "$_need_dns" ] && _server=`getent hosts $_server| head -n 1 | cut -d' ' -f1`
fi
_netdev=`/sbin/ip route get to $_server 2>&1`
[ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1
_netdev=${_netdev#*dev}
_netdev=`echo $_netdev | cut -d' ' -f1 `
kdump_setup_netdev "${_netdev}"
#save netdev used for kdump as cmdline
@@ -542,6 +555,8 @@ install() { inst "/bin/date" "/bin/date" inst "/bin/sync" "/bin/sync" inst "/bin/cut" "/bin/cut"
- inst "/bin/getent" "/bin/getent"
- inst "/bin/head" "/bin/head" inst "/sbin/makedumpfile" "/sbin/makedumpfile" inst "/sbin/vmcore-dmesg" "/sbin/vmcore-dmesg" inst_hook pre-pivot 9999 "$moddir/kdump.sh"
diff --git a/kdump-lib.sh b/kdump-lib.sh index a20c6e8..5e9f973 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -44,6 +44,29 @@ strip_comments() echo $@ | sed -e 's/(.*)#.*/\1/' }
+# check the remote server ip address tpye +is_ipv6_target() +{
- local _server _server_tmp
- if is_ssh_dump_target; then
_server=`grep "^ssh " /etc/kdump.conf`
- elif is_nfs_dump_target; then
_server=`grep "^nfs " /etc/kdump.conf`
- fi
- [ -z "$_server" ] && return 1
- _server=`strip_comments $_server`
- _server=${_server#*@}
- _server=${_server%:/*}
- _server=${_server#[}
- _server=${_server%]}
- _server=${_server%%*}
- _server_tmp=$_server
- _server=`getent hosts $_server | head -n 1 | cut -d' ' -f1`
- _server=${_server:-$_server_tmp}
- echo $_server | grep -q ":"
+}
# Check if fence kdump is configured in Pacemaker cluster is_pcs_fence_kdump() { -- 1.8.4.2
On 06/25/14 at 05:03pm, Dave Young wrote:
On 06/20/14 at 05:41pm, Arthur Zou wrote:
Resolves: bz821620
Description: Currently kdump doesn't support ipv6 nfs/ssh dump. Ipv6 is the latest version of the Internet Protocal. so it is a significant feture for kdump to enhance to support ipv6.
Solutions: Since dracut has supported ipv6 now, it is easy to change the kdump code to support ipv6. Just need pass the right _ip_opts to the second kernle. What is the main difference in userspace bettwen ipv4 and ipv6 is the ip address format. For ipv6 nfs dump: if ipv6 address type is link scope, /etc/kdump.conf should be edited like "nfs [fe80::5054:ff:fe48:ca80%eth0]:/mnt" else /etc/kdump.conf should be edited like "nfs [2001:db8:0:f101::2]:/mnt" For ipv6 ssh dump if ipv6 address type is link scope, /etc/kdump.conf should be edited like "ssh root@fe80::5054:ff:fe48:ca80%eth0" else /etc/kdump.conf should be edited like "ssh root@2001:db8:0:f101::2"
What this patch do is: a): Add a function is_ipv6_target to tell what version of Internet Protocal (ipv4/ipv6) kdump will use to dump to remote target. b): Modify kdump_install_net to handle ipv6 configuration in /etc/kdump.conf correctly. Get the ipv6 address from /etc/kdump.conf is more complicated than ipv4 because the difference configuration format mentioned above. c): Based on the ip address type, using corresponding ip address as HOST_IP in second kernel.
It was tested for IPV6 and IPV4 address in beaker machine https://beaker.engineering .redhat.com/jobs/675666(client) and https://beaker.engineering.redhat.com/jobs/674574 (server) and passed
Note: Currntly only f19 support remount a nfs target in ipv6. detail in https: //bugzilla.redhat.com/show_bug.cgi?id=1099761
It seems can not apply to latest kexec-tools. Arthur, could you address comments from Chao and rebase to latest repo?
Ok
Thanks arthur
Signed-off-by: Arthur Zou zzou@redhat.com
dracut-kdump.sh | 9 +++++++-- dracut-module-setup.sh | 47 +++++++++++++++++++++++++++++++---------------- kdump-lib.sh | 23 +++++++++++++++++++++++ 3 files changed, 61 insertions(+), 18 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh index cb13d92..5dcd8a4 100755 --- a/dracut-kdump.sh +++ b/dracut-kdump.sh @@ -206,9 +206,14 @@ get_host_ip() then kdumpnic=$(getarg kdumpnic=) [ -z "$kdumpnic" ] && echo "kdump: failed to get kdumpnic!" && return 1
_host=`ip addr show dev $kdumpnic|grep 'inet '`
if is_ipv6_target
then
_host=`ip addr show dev $kdumpnic|grep 'inet6'`
else
_host=`ip addr show dev $kdumpnic|grep 'inet '`
fi [ $? -ne 0 ] && echo "kdump: wrong kdumpnic: $kdumpnic" && return 1
_host="${_host##*inet }"
_host=`echo $_host | cut -d' ' -f2` _host="${_host%%/*}" [ -z "$_host" ] && echo "kdump: wrong kdumpnic: $kdumpnic" && return 1 HOST_IP=$_host
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 2a16900..c13ed18 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -64,6 +64,7 @@ kdump_setup_dns() { . /etc/sysconfig/network-scripts/ifcfg-$1 [ -n "$DNS1" ] && echo "nameserver=$DNS1" > "$_dnsfile" [ -n "$DNS2" ] && echo "nameserver=$DNS2" >> "$_dnsfile"
- [ -f /etc/resolv.conf ] && cat /etc/resolv.conf >> "$_dnsfile"
}
#$1: netdev name @@ -71,10 +72,20 @@ kdump_setup_dns() { #if it use static ip echo it, or echo null kdump_static_ip() { . /etc/sysconfig/network-scripts/ifcfg-$1
- if [ -n "$IPADDR" ]; then
[ -z "$NETMASK" -a -n "$PREFIX" ] && \
- if is_ipv6_target
- then
if [ -n "$IPV6ADDR" ]; then
IPV6ADDR=${IPV6ADDR%/*} #strip the surfix
IPV6ADDR="[${IPV6ADDR}]"
IPV6_DEFAULTGW="[${IPV6_DEFAULTGW}]"
echo -n "${IPV6ADDR}::${IPV6_DEFAULTGW}:64::"
fi
- else
if [ -n "$IPADDR" ]; then
[ -z "$NETMASK" -a -n "$PREFIX" ] && \ NETMASK=$(ipcalc -m $IPADDR/$PREFIX | cut -d'=' -f2)
echo -n "${IPADDR}::${GATEWAY}:${NETMASK}::"
echo -n "${IPADDR}::${GATEWAY}:${NETMASK}::"
fifi
}
@@ -227,24 +238,26 @@ kdump_install_net() { local _server _netdev local config_val="$1"
- _server=`echo $config_val | sed 's/.*@//' | cut -d':' -f1`
- _need_dns=`echo $_server|grep "[a-zA-Z]"`
- [ -n "$_need_dns" ] && _server=`getent hosts $_server|cut -d' ' -f1`
- _server=`echo $config_val | sed 's/.*@//'`
- _server=${_server%:/*}
- _server=${_server#[}
- _server=${_server%]}
- _server=${_server%%*} #strip the zone_ID if exist
- _netdev=`/sbin/ip route get to $_server 2>&1`
- [ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1
- #the field in the ip output changes if we go to another subnet
- if [ -n "`echo $_netdev | grep via`" ]
- if is_ipv6_target then
# we are going to a different subnet
_netdev=`echo $_netdev|awk '{print $5;}'|head -n 1`
_need_dns=`echo $_server|grep "[:]"`
else[ -z "$_need_dns" ] && _server=`getent hosts $_server| head -n 1 | cut -d' ' -f1`
# we are on the same subnet
_netdev=`echo $_netdev|awk '{print $3}'|head -n 1`
_need_dns=`echo $_server|grep "[a-zA-Z]"`
[ -n "$_need_dns" ] && _server=`getent hosts $_server| head -n 1 | cut -d' ' -f1`
fi
_netdev=`/sbin/ip route get to $_server 2>&1`
[ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1
_netdev=${_netdev#*dev}
_netdev=`echo $_netdev | cut -d' ' -f1 `
kdump_setup_netdev "${_netdev}"
#save netdev used for kdump as cmdline
@@ -542,6 +555,8 @@ install() { inst "/bin/date" "/bin/date" inst "/bin/sync" "/bin/sync" inst "/bin/cut" "/bin/cut"
- inst "/bin/getent" "/bin/getent"
- inst "/bin/head" "/bin/head" inst "/sbin/makedumpfile" "/sbin/makedumpfile" inst "/sbin/vmcore-dmesg" "/sbin/vmcore-dmesg" inst_hook pre-pivot 9999 "$moddir/kdump.sh"
diff --git a/kdump-lib.sh b/kdump-lib.sh index a20c6e8..5e9f973 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -44,6 +44,29 @@ strip_comments() echo $@ | sed -e 's/(.*)#.*/\1/' }
+# check the remote server ip address tpye +is_ipv6_target() +{
- local _server _server_tmp
- if is_ssh_dump_target; then
_server=`grep "^ssh " /etc/kdump.conf`
- elif is_nfs_dump_target; then
_server=`grep "^nfs " /etc/kdump.conf`
- fi
- [ -z "$_server" ] && return 1
- _server=`strip_comments $_server`
- _server=${_server#*@}
- _server=${_server%:/*}
- _server=${_server#[}
- _server=${_server%]}
- _server=${_server%%*}
- _server_tmp=$_server
- _server=`getent hosts $_server | head -n 1 | cut -d' ' -f1`
- _server=${_server:-$_server_tmp}
- echo $_server | grep -q ":"
+}
# Check if fence kdump is configured in Pacemaker cluster is_pcs_fence_kdump() { -- 1.8.4.2