This patch is a contrast of patch v3 which pass a commandline to second kenel to tell the ip address type. In this approach, Install extra getent and head in initramfs so that we can use it to tell the ip address type in the second kernel. Comparing with patch v3, this approach will cause the size of decompressed initramfs increase about 72K which I think is acceptable.
Resolves: bz821620
Currently dracut has supported for ipv6, and it is a significant feture for kdump to enhance to support ipv6.
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"
Signed-off-by: Arthur Zou zzou@redhat.com --- dracut-kdump.sh | 10 ++++++++-- dracut-module-setup.sh | 37 ++++++++++++++++++++++++++++++------- kdump-lib.sh | 23 +++++++++++++++++++++++ 3 files changed, 61 insertions(+), 9 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh index cb13d92..c215bee 100755 --- a/dracut-kdump.sh +++ b/dracut-kdump.sh @@ -206,10 +206,16 @@ 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="${_host#*inet}" _host="${_host%%/*}" + _host=`echo $_host | cut -d' ' -f2` [ -z "$_host" ] && echo "kdump: wrong kdumpnic: $kdumpnic" && return 1 HOST_IP=$_host fi diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 2a16900..e3e0ee6 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 prefix + 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,16 +238,26 @@ kdump_install_net() { local _server _netdev local config_val="$1"
- _server=`echo $config_val | sed 's/.*@//' | cut -d':' -f1` + _server=`echo $config_val | sed 's/.*@//'` + _server=${_server%:/*} + _server=${_server#[} + _server=${_server%]} + _server=${_server%%*} #strip the zone_ID if exist
- _need_dns=`echo $_server|grep "[a-zA-Z]"` - [ -n "$_need_dns" ] && _server=`getent hosts $_server|cut -d' ' -f1` + if is_ipv6_target + then + _need_dns=`echo $_server|grep "[:]"` + [ -z "$_need_dns" ] && _server=`getent hosts $_server| head -n 1 | cut -d' ' -f1` + else + _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
#the field in the ip output changes if we go to another subnet - if [ -n "`echo $_netdev | grep via`" ] + if [ -n "`echo $_netdev | grep -E 'via|from'`" ] then # we are going to a different subnet _netdev=`echo $_netdev|awk '{print $5;}'|head -n 1` @@ -542,6 +563,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 Tue, Jun 10, 2014 at 01:20:05PM +0800, Arthur Zou wrote:
This patch is a contrast of patch v3 which pass a commandline to second kenel to tell the ip address type. In this approach, Install extra getent and head in
Arthur,
Except subject line, changelog don't tell me that what's the problem, why are we putting this patch and how this patch fixes it.
initramfs so that we can use it to tell the ip address type in the second kernel. Comparing with patch v3, this approach will cause the size of decompressed initramfs increase about 72K which I think is acceptable.
Resolves: bz821620
Hi Marc, Bao and Dave,
Can you please help review ipv6 support?
Thanks Vivek
Currently dracut has supported for ipv6, and it is a significant feture for kdump to enhance to support ipv6.
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"
Signed-off-by: Arthur Zou zzou@redhat.com
dracut-kdump.sh | 10 ++++++++-- dracut-module-setup.sh | 37 ++++++++++++++++++++++++++++++------- kdump-lib.sh | 23 +++++++++++++++++++++++ 3 files changed, 61 insertions(+), 9 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh index cb13d92..c215bee 100755 --- a/dracut-kdump.sh +++ b/dracut-kdump.sh @@ -206,10 +206,16 @@ 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="${_host#*inet}" _host="${_host%%/*}"
fi_host=`echo $_host | cut -d' ' -f2` [ -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..e3e0ee6 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 prefix
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,16 +238,26 @@ kdump_install_net() { local _server _netdev local config_val="$1"
- _server=`echo $config_val | sed 's/.*@//' | cut -d':' -f1`
- _server=`echo $config_val | sed 's/.*@//'`
- _server=${_server%:/*}
- _server=${_server#[}
- _server=${_server%]}
- _server=${_server%%*} #strip the zone_ID if exist
- _need_dns=`echo $_server|grep "[a-zA-Z]"`
- [ -n "$_need_dns" ] && _server=`getent hosts $_server|cut -d' ' -f1`
if is_ipv6_target
then
_need_dns=`echo $_server|grep "[:]"`
[ -z "$_need_dns" ] && _server=`getent hosts $_server| head -n 1 | cut -d' ' -f1`
else
_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
#the field in the ip output changes if we go to another subnet
- if [ -n "`echo $_netdev | grep via`" ]
- if [ -n "`echo $_netdev | grep -E 'via|from'`" ] then # we are going to a different subnet _netdev=`echo $_netdev|awk '{print $5;}'|head -n 1`
@@ -542,6 +563,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
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
On 06/12/14 at 08:43am, Vivek Goyal wrote:
On Tue, Jun 10, 2014 at 01:20:05PM +0800, Arthur Zou wrote:
This patch is a contrast of patch v3 which pass a commandline to second kenel to tell the ip address type. In this approach, Install extra getent and head in
Arthur,
Except subject line, changelog don't tell me that what's the problem, why are we putting this patch and how this patch fixes it.
initramfs so that we can use it to tell the ip address type in the second kernel. Comparing with patch v3, this approach will cause the size of decompressed initramfs increase about 72K which I think is acceptable.
Resolves: bz821620
Hi Marc, Bao and Dave,
Can you please help review ipv6 support?
Arthur explained about the detail of this patch to us (chao, bhe and me) f2f. The patch overall looks good but I think there should be some documentaion changes as well in this patch.
Thanks Vivek
Currently dracut has supported for ipv6, and it is a significant feture for kdump to enhance to support ipv6.
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"
Signed-off-by: Arthur Zou zzou@redhat.com
dracut-kdump.sh | 10 ++++++++-- dracut-module-setup.sh | 37 ++++++++++++++++++++++++++++++------- kdump-lib.sh | 23 +++++++++++++++++++++++ 3 files changed, 61 insertions(+), 9 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh index cb13d92..c215bee 100755 --- a/dracut-kdump.sh +++ b/dracut-kdump.sh @@ -206,10 +206,16 @@ 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="${_host#*inet}" _host="${_host%%/*}"
fi_host=`echo $_host | cut -d' ' -f2` [ -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..e3e0ee6 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 prefix
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,16 +238,26 @@ kdump_install_net() { local _server _netdev local config_val="$1"
- _server=`echo $config_val | sed 's/.*@//' | cut -d':' -f1`
- _server=`echo $config_val | sed 's/.*@//'`
- _server=${_server%:/*}
- _server=${_server#[}
- _server=${_server%]}
- _server=${_server%%*} #strip the zone_ID if exist
- _need_dns=`echo $_server|grep "[a-zA-Z]"`
- [ -n "$_need_dns" ] && _server=`getent hosts $_server|cut -d' ' -f1`
if is_ipv6_target
then
_need_dns=`echo $_server|grep "[:]"`
[ -z "$_need_dns" ] && _server=`getent hosts $_server| head -n 1 | cut -d' ' -f1`
else
_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
#the field in the ip output changes if we go to another subnet
- if [ -n "`echo $_netdev | grep via`" ]
- if [ -n "`echo $_netdev | grep -E 'via|from'`" ] then # we are going to a different subnet _netdev=`echo $_netdev|awk '{print $5;}'|head -n 1`
@@ -542,6 +563,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
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
On Fri, Jun 13, 2014 at 02:37:26PM +0800, Dave Young wrote:
On 06/12/14 at 08:43am, Vivek Goyal wrote:
On Tue, Jun 10, 2014 at 01:20:05PM +0800, Arthur Zou wrote:
This patch is a contrast of patch v3 which pass a commandline to second kenel to tell the ip address type. In this approach, Install extra getent and head in
Arthur,
Except subject line, changelog don't tell me that what's the problem, why are we putting this patch and how this patch fixes it.
initramfs so that we can use it to tell the ip address type in the second kernel. Comparing with patch v3, this approach will cause the size of decompressed initramfs increase about 72K which I think is acceptable.
Resolves: bz821620
Hi Marc, Bao and Dave,
Can you please help review ipv6 support?
Arthur explained about the detail of this patch to us (chao, bhe and me) f2f. The patch overall looks good but I think there should be some documentaion changes as well in this patch.
Ok. I wish there is some discussion on mailing list also. That helps others like me to know what questions have been raised. And what's the design etc.
Thanks Vivek
Thanks Vivek
Currently dracut has supported for ipv6, and it is a significant feture for kdump to enhance to support ipv6.
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"
Signed-off-by: Arthur Zou zzou@redhat.com
dracut-kdump.sh | 10 ++++++++-- dracut-module-setup.sh | 37 ++++++++++++++++++++++++++++++------- kdump-lib.sh | 23 +++++++++++++++++++++++ 3 files changed, 61 insertions(+), 9 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh index cb13d92..c215bee 100755 --- a/dracut-kdump.sh +++ b/dracut-kdump.sh @@ -206,10 +206,16 @@ 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="${_host#*inet}" _host="${_host%%/*}"
fi_host=`echo $_host | cut -d' ' -f2` [ -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..e3e0ee6 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 prefix
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,16 +238,26 @@ kdump_install_net() { local _server _netdev local config_val="$1"
- _server=`echo $config_val | sed 's/.*@//' | cut -d':' -f1`
- _server=`echo $config_val | sed 's/.*@//'`
- _server=${_server%:/*}
- _server=${_server#[}
- _server=${_server%]}
- _server=${_server%%*} #strip the zone_ID if exist
- _need_dns=`echo $_server|grep "[a-zA-Z]"`
- [ -n "$_need_dns" ] && _server=`getent hosts $_server|cut -d' ' -f1`
if is_ipv6_target
then
_need_dns=`echo $_server|grep "[:]"`
[ -z "$_need_dns" ] && _server=`getent hosts $_server| head -n 1 | cut -d' ' -f1`
else
_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
#the field in the ip output changes if we go to another subnet
- if [ -n "`echo $_netdev | grep via`" ]
- if [ -n "`echo $_netdev | grep -E 'via|from'`" ] then # we are going to a different subnet _netdev=`echo $_netdev|awk '{print $5;}'|head -n 1`
@@ -542,6 +563,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
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
On 06/13/14 at 08:38am, Vivek Goyal wrote:
On Fri, Jun 13, 2014 at 02:37:26PM +0800, Dave Young wrote:
On 06/12/14 at 08:43am, Vivek Goyal wrote:
On Tue, Jun 10, 2014 at 01:20:05PM +0800, Arthur Zou wrote:
This patch is a contrast of patch v3 which pass a commandline to second kenel to tell the ip address type. In this approach, Install extra getent and head in
Arthur,
Except subject line, changelog don't tell me that what's the problem, why are we putting this patch and how this patch fixes it.
initramfs so that we can use it to tell the ip address type in the second kernel. Comparing with patch v3, this approach will cause the size of decompressed initramfs increase about 72K which I think is acceptable.
Resolves: bz821620
Hi Marc, Bao and Dave,
Can you please help review ipv6 support?
Arthur explained about the detail of this patch to us (chao, bhe and me) f2f. The patch overall looks good but I think there should be some documentaion changes as well in this patch.
Ok. I wish there is some discussion on mailing list also. That helps others like me to know what questions have been raised. And what's the design etc.
Just we have totally no idea about IPV6 so we asked Arthur to explain the basic knowledge about IPV6 and its usage and then talked about his patch.
BTW, Arthur Could you explain more detail about how to test in Virtual machine in patch description?
Thanks Dave
On 06/16/14 at 09:54am, Dave Young wrote:
On 06/13/14 at 08:38am, Vivek Goyal wrote:
On Fri, Jun 13, 2014 at 02:37:26PM +0800, Dave Young wrote:
On 06/12/14 at 08:43am, Vivek Goyal wrote:
On Tue, Jun 10, 2014 at 01:20:05PM +0800, Arthur Zou wrote:
This patch is a contrast of patch v3 which pass a commandline to second kenel to tell the ip address type. In this approach, Install extra getent and head in
Arthur,
Except subject line, changelog don't tell me that what's the problem, why are we putting this patch and how this patch fixes it.
initramfs so that we can use it to tell the ip address type in the second kernel. Comparing with patch v3, this approach will cause the size of decompressed initramfs increase about 72K which I think is acceptable.
Resolves: bz821620
Hi Marc, Bao and Dave,
Can you please help review ipv6 support?
Arthur explained about the detail of this patch to us (chao, bhe and me) f2f. The patch overall looks good but I think there should be some documentaion changes as well in this patch.
Ok. I wish there is some discussion on mailing list also. That helps others like me to know what questions have been raised. And what's the design etc.
Just we have totally no idea about IPV6 so we asked Arthur to explain the basic knowledge about IPV6 and its usage and then talked about his patch.
BTW, Arthur Could you explain more detail about how to test in Virtual machine in patch description?
Thanks Dave
Ok
Thanks zzou
On 06/12/14 at 08:43am, Vivek Goyal wrote:
On Tue, Jun 10, 2014 at 01:20:05PM +0800, Arthur Zou wrote:
This patch is a contrast of patch v3 which pass a commandline to second kenel to tell the ip address type. In this approach, Install extra getent and head in
Arthur,
Except subject line, changelog don't tell me that what's the problem, why are we putting this patch and how this patch fixes it.
Hi Vivek, I will add some descriptiones of problem and solution in changelog.
Thanks zzou
initramfs so that we can use it to tell the ip address type in the second kernel. Comparing with patch v3, this approach will cause the size of decompressed initramfs increase about 72K which I think is acceptable.
Resolves: bz821620
Hi Marc, Bao and Dave,
Can you please help review ipv6 support?
Thanks Vivek
Currently dracut has supported for ipv6, and it is a significant feture for kdump to enhance to support ipv6.
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"
Signed-off-by: Arthur Zou zzou@redhat.com
dracut-kdump.sh | 10 ++++++++-- dracut-module-setup.sh | 37 ++++++++++++++++++++++++++++++------- kdump-lib.sh | 23 +++++++++++++++++++++++ 3 files changed, 61 insertions(+), 9 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh index cb13d92..c215bee 100755 --- a/dracut-kdump.sh +++ b/dracut-kdump.sh @@ -206,10 +206,16 @@ 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="${_host#*inet}" _host="${_host%%/*}"
fi_host=`echo $_host | cut -d' ' -f2` [ -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..e3e0ee6 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 prefix
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,16 +238,26 @@ kdump_install_net() { local _server _netdev local config_val="$1"
- _server=`echo $config_val | sed 's/.*@//' | cut -d':' -f1`
- _server=`echo $config_val | sed 's/.*@//'`
- _server=${_server%:/*}
- _server=${_server#[}
- _server=${_server%]}
- _server=${_server%%*} #strip the zone_ID if exist
- _need_dns=`echo $_server|grep "[a-zA-Z]"`
- [ -n "$_need_dns" ] && _server=`getent hosts $_server|cut -d' ' -f1`
if is_ipv6_target
then
_need_dns=`echo $_server|grep "[:]"`
[ -z "$_need_dns" ] && _server=`getent hosts $_server| head -n 1 | cut -d' ' -f1`
else
_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
#the field in the ip output changes if we go to another subnet
- if [ -n "`echo $_netdev | grep via`" ]
- if [ -n "`echo $_netdev | grep -E 'via|from'`" ] then # we are going to a different subnet _netdev=`echo $_netdev|awk '{print $5;}'|head -n 1`
@@ -542,6 +563,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
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
On 06/10/2014 01:20 AM, Arthur Zou wrote:
This patch is a contrast of patch v3 which pass a commandline to second kenel to tell the ip address type. In this approach, Install extra getent and head in initramfs so that we can use it to tell the ip address type in the second kernel. Comparing with patch v3, this approach will cause the size of decompressed initramfs increase about 72K which I think is acceptable.
Resolves: bz821620
Currently dracut has supported for ipv6, and it is a significant feture for kdump to enhance to support ipv6.
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"
Signed-off-by: Arthur Zou zzou@redhat.com
It would be nice to see that it was tested for IPV6 and IPV4 addresses. Otherwise, looks good.
ACK
Marc
dracut-kdump.sh | 10 ++++++++-- dracut-module-setup.sh | 37 ++++++++++++++++++++++++++++++------- kdump-lib.sh | 23 +++++++++++++++++++++++ 3 files changed, 61 insertions(+), 9 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh index cb13d92..c215bee 100755 --- a/dracut-kdump.sh +++ b/dracut-kdump.sh @@ -206,10 +206,16 @@ 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="${_host#*inet}" _host="${_host%%/*}"
_host=`echo $_host | cut -d' ' -f2` [ -z "$_host" ] && echo "kdump: wrong kdumpnic: $kdumpnic" && return 1 HOST_IP=$_host fi
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 2a16900..e3e0ee6 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 prefix
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,16 +238,26 @@ kdump_install_net() { local _server _netdev local config_val="$1"
- _server=`echo $config_val | sed 's/.*@//' | cut -d':' -f1`
- _server=`echo $config_val | sed 's/.*@//'`
- _server=${_server%:/*}
- _server=${_server#[}
- _server=${_server%]}
- _server=${_server%%*} #strip the zone_ID if exist
- _need_dns=`echo $_server|grep "[a-zA-Z]"`
- [ -n "$_need_dns" ] && _server=`getent hosts $_server|cut -d' ' -f1`
if is_ipv6_target
then
_need_dns=`echo $_server|grep "[:]"`
[ -z "$_need_dns" ] && _server=`getent hosts $_server| head -n 1 | cut -d' ' -f1`
else
_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
#the field in the ip output changes if we go to another subnet
- if [ -n "`echo $_netdev | grep via`" ]
- if [ -n "`echo $_netdev | grep -E 'via|from'`" ] then # we are going to a different subnet _netdev=`echo $_netdev|awk '{print $5;}'|head -n 1`
@@ -542,6 +563,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/10/14 at 01:20pm, Arthur Zou wrote:
This patch is a contrast of patch v3 which pass a commandline to second kenel to tell the ip address type. In this approach, Install extra getent and head in initramfs so that we can use it to tell the ip address type in the second kernel. Comparing with patch v3, this approach will cause the size of decompressed initramfs increase about 72K which I think is acceptable.
Resolves: bz821620
Currently dracut has supported for ipv6, and it is a significant feture for kdump to enhance to support ipv6.
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"
I would suggest to add documentation/examples to kdump.conf.5 manpage and the howto file.
Another problem I remember you said there's still one bug for nfs remount which is assigned to nfs people, so please explictly mention it in patch description about the limitation.
As Marc said, ensure both IPV4/IPV6 are tested. Maybe add the test status in patch description will be better.
Signed-off-by: Arthur Zou zzou@redhat.com
dracut-kdump.sh | 10 ++++++++-- dracut-module-setup.sh | 37 ++++++++++++++++++++++++++++++------- kdump-lib.sh | 23 +++++++++++++++++++++++ 3 files changed, 61 insertions(+), 9 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh index cb13d92..c215bee 100755 --- a/dracut-kdump.sh +++ b/dracut-kdump.sh @@ -206,10 +206,16 @@ 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="${_host#*inet}" _host="${_host%%/*}"
fi_host=`echo $_host | cut -d' ' -f2` [ -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..e3e0ee6 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 prefix
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,16 +238,26 @@ kdump_install_net() { local _server _netdev local config_val="$1"
- _server=`echo $config_val | sed 's/.*@//' | cut -d':' -f1`
- _server=`echo $config_val | sed 's/.*@//'`
- _server=${_server%:/*}
- _server=${_server#[}
- _server=${_server%]}
- _server=${_server%%*} #strip the zone_ID if exist
- _need_dns=`echo $_server|grep "[a-zA-Z]"`
- [ -n "$_need_dns" ] && _server=`getent hosts $_server|cut -d' ' -f1`
if is_ipv6_target
then
_need_dns=`echo $_server|grep "[:]"`
[ -z "$_need_dns" ] && _server=`getent hosts $_server| head -n 1 | cut -d' ' -f1`
else
_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
#the field in the ip output changes if we go to another subnet
- if [ -n "`echo $_netdev | grep via`" ]
- if [ -n "`echo $_netdev | grep -E 'via|from'`" ] then # we are going to a different subnet _netdev=`echo $_netdev|awk '{print $5;}'|head -n 1`
@@ -542,6 +563,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