Question: is there any automated way of building rpm package?
by HATAYAMA Daisuke
Hello,
Is there any automated way of building rpm package?
That is, installing files such eppic, kexec-tools-po, makedumpfile and kexec-tools with expected file names necessary for installation, place them proper file path location and then execute rpmbuild command.
I first found out there's no Makefile and INSTALL file, and then I tried preparing them manually in an ad-hoc way, but faced build failure several times and gave up.
--
Thanks.
HATAYAMA, Daisuke
8 years, 6 months
[PATCH v6 0/7] kdump: Modify kdump init script to support firmware-assisted dump
by Hari Bathini
This patch set implements firmware-assisted dump support for kdump
service. Firmware-assisted dump support depends on existing kdump
infrastructure (kdump scripts) present in userland to save dump
to the disk. Though existing kdump script will work seemlessly, it
still needs to modified to make it aware of presense of firmware-
assisted dump feature during service start and stop. These changes
are tested successfully on a power box with fedora19.
Changes from v5 to v6:
1. Using common global variable TARGET_INITRD for both kdump and
fadump modes
2. Reworked on determine_dump_mode routine
3. Using a temporary image for rebuilding
---
Hari Bathini (7):
kdump: Modify status routine to check for firmware-assisted dump
kdump: Modify kdump script to start the firmware assisted dump.
kdump: Modify kdump script to stop firmware assisted dump
kdump: Rebuild default initrd for firmware assisted dump
kdump: Check for /proc/vmcore existence before capturing the vmcore.
kdump: Add firmware-assisted dump howto document
cleanup: Remove "function" keyword from all functions and correct typos
dracut-kdump.sh | 3 +
fadump-howto.txt | 250 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
kdumpctl | 242 ++++++++++++++++++++++++++++++++++++++++++++--------
3 files changed, 456 insertions(+), 39 deletions(-)
create mode 100644 fadump-howto.txt
--
- Hari
9 years, 4 months
[PATCH v2 0/6] Kdump error handling service
by WANG Chao
Hi, All
This patchset introduce a new kdump emergency service. It will override the
existing emergency.service. When fatal error occurs, this emergency service
will be triggered and systemd will isolate to emergency path.
This kdump emergency service can will read kdump.conf and act according to the
configired "default action" (reboot/poweroff/halt/shell/dump_to_rootfs).
Along with this patchset, kdump-capture.service is introduced as a service unit
to run kdump.sh. When kdump-capture.service fails, systemd will isolate to
kdump emergency service. I copied all the dependencies from
dracut-pre-pivot.service to kdump-capture.service so that kdump.sh will be
called at the correct time window.
v2:
Address several comments from Vivek:
- split [patch 1] into 1/6 and 2/6
- remove several unnecessary lines in service unit.
- modify the description of kdump-capture.service
- introduce another kdump lib kdump-lib-2.sh used in 2nd kernel.
WANG Chao (6):
mkdumprd: mount dump target under /sysroot in 2nd kernel
mkdumprd: append "x-initrd.mount" to the mount options.
cleanup: extract functions from kdump.sh to kdump-lib-2.sh
Introduce kdump error handling service
Introduce kdump capture service
disable dracut-emergency.service the whole time
dracut-kdump-capture.service | 23 ++++++
dracut-kdump-emergency.service | 23 ++++++
dracut-kdump-error-handler.sh | 10 +++
dracut-kdump-lib-2.sh | 160 ++++++++++++++++++++++++++++++++++++++++
dracut-kdump.sh | 161 +----------------------------------------
dracut-module-setup.sh | 8 +-
kdump-lib.sh | 6 +-
kexec-tools.spec | 9 ++-
mkdumprd | 25 ++++---
9 files changed, 253 insertions(+), 172 deletions(-)
create mode 100644 dracut-kdump-capture.service
create mode 100644 dracut-kdump-emergency.service
create mode 100755 dracut-kdump-error-handler.sh
create mode 100755 dracut-kdump-lib-2.sh
--
1.9.3
9 years, 4 months
[Patch v2] Add static route into cmdline if target address is not local
by Baoquan He
If one target address is not local and its route is different than
default gateway, the specific route to this target address need be
added.
In this patch, get the route to the specific target address and store
it as cmdline, here is /etc/cmdline.d/45-route-static.conf. And the
route options are separated by underscore like below. Then the sotred
route can be parsed when kdump kernel boot up.
192.168.200.0/24_via_192.168.100.222_dev_ens10
---
dracut-module-setup.sh | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 87ad072..f1d0d28 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -79,6 +79,11 @@ kdump_static_ip() {
_gateway=$(ip route list dev $_netdev | awk '/^default /{print $3}')
echo -n "${_srcaddr}::${_gateway}:${_netmask}::"
fi
+
+ /sbin/ip route show | grep -v default | grep "^[[:digit:]].*via.* $_netdev " |\
+ while read line; do
+ echo $line | awk '{printf("rd.route=%s_%s_%s_%s_%s\n", $1, $2, $3, $4, $5)}'
+ done >> ${initdir}/etc/cmdline.d/45route-static.conf
}
kdump_get_mac_addr() {
--
1.9.0
9 years, 5 months
[PATCH v6] Enhance kdump to support ipv6
by Arthur Zou
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 and passed.
Note:
1): Currntly only f19 support remount a nfs target in ipv6. detail in https:
//bugzilla.redhat.com/show_bug.cgi?id=1099761. If using in f20, you can
comment out "mount -o remount,rw $_mp || return 1" in kdump.sh line 105.
2): If Using static ipv6 address and configuring nfs/ssh with hostname of
remote target, MUST add a ipv6 DNS in ifcfg-devname.
How to create a ipv6 enviromnet.
1): Reserving two beaker machine with family fedora19.
2): Choosing a beaker machine as a nfs/ssh server and delete it's ipv4 address
by "ip address del ipv4-address dev nicname"
3): Configuring the /etc/kdump.conf like mentioned above.
Signed-off-by: Arthur Zou <zzou(a)redhat.com>
---
dracut-kdump.sh | 9 ++++--
dracut-module-setup.sh | 74 ++++++++++++++++++++++++++++++++++++++------------
kdump-lib.sh | 25 +++++++++++++++++
3 files changed, 89 insertions(+), 19 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 87ad072..93ff259 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -70,14 +70,25 @@ kdump_setup_dns() {
#$2: srcaddr
#if it use static ip echo it, or echo null
kdump_static_ip() {
- local _netmask _gateway
+ local _netmask _gateway _ipaddr
local _netdev="$1" _srcaddr="$2"
- local _ipaddr=$(ip addr show dev $_netdev permanent | \
+
+ if is_ipv6_target
+ then
+ _ipaddr=$(ip addr show dev $_netdev permanent | \
+ awk "/ $_srcaddr\/.* /{print \$2}")
+ if [ -n "$_ipaddr" ]; then
+ _gateway=$(ip -6 route list dev $_netdev | awk '/^default /{print $3}')
+ echo -n "[${_srcaddr}]::[${_gateway}]:64::"
+ fi
+ else
+ _ipaddr=$(ip addr show dev $_netdev permanent | \
awk "/ $_srcaddr\/.* $_netdev\$/{print \$2}")
- if [ -n "$_ipaddr" ]; then
- _netmask=$(ipcalc -m $_ipaddr | cut -d'=' -f2)
- _gateway=$(ip route list dev $_netdev | awk '/^default /{print $3}')
- echo -n "${_srcaddr}::${_gateway}:${_netmask}::"
+ if [ -n "$_ipaddr" ]; then
+ _netmask=$(ipcalc -m $_ipaddr | cut -d'=' -f2)
+ _gateway=$(ip route list dev $_netdev | awk '/^default /{print $3}')
+ echo -n "${_srcaddr}::${_gateway}:${_netmask}::"
+ fi
fi
}
@@ -231,24 +242,51 @@ kdump_install_net() {
local _server _netdev _srcaddr
local config_val="$1"
- _server=`echo $config_val | sed 's/.*@//' | cut -d':' -f1`
+ # ipv6 config_val is like mnt [xxxx:xxxx::xxxx%eth0]:/mnt/nfs or
+ # ssh username@xxxx:xxxx::xxxx%eth0, what we need is xxxx:xxxx::xxxx
+ _server=`echo $config_val | sed 's/.*@//'`
+ _server=${_server%:/*}
+ _server=${_server#[}
+ _server=${_server%]}
+ _server=${_server%\%*} #strip the zone_ID if exist, like %eth0 above
- _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 is_ipv6_target
then
- # we are going to a different subnet
- _srcaddr=`echo $_netdev|awk '{print $7}'|head -n 1`
- _netdev=`echo $_netdev|awk '{print $5;}'|head -n 1`
+ #the field in the ip output changes if we go to another subnet
+ if [ -n "`echo $_netdev | grep via`" ]
+ then
+ # we are going to a different subnet
+ _srcaddr=`echo $_netdev|awk '{print $9}'|head -n 1`
+ _netdev=`echo $_netdev|awk '{print $7;}'|head -n 1`
+ else
+ # we are on the same subnet
+ _srcaddr=`echo $_netdev|awk '{print $7}'|head -n 1`
+ _netdev=`echo $_netdev|awk '{print $5}'|head -n 1`
+ fi
else
- # we are on the same subnet
- _srcaddr=`echo $_netdev|awk '{print $5}'|head -n 1`
- _netdev=`echo $_netdev|awk '{print $3}'|head -n 1`
+ #the field in the ip output changes if we go to another subnet
+ if [ -n "`echo $_netdev | grep via`" ]
+ then
+ # we are going to a different subnet
+ _srcaddr=`echo $_netdev|awk '{print $7}'|head -n 1`
+ _netdev=`echo $_netdev|awk '{print $5;}'|head -n 1`
+ else
+ # we are on the same subnet
+ _srcaddr=`echo $_netdev|awk '{print $5}'|head -n 1`
+ _netdev=`echo $_netdev|awk '{print $3}'|head -n 1`
+ fi
fi
kdump_setup_netdev "${_netdev}" "${_srcaddr}"
@@ -551,6 +589,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..8f68d31 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -138,3 +138,28 @@ check_save_path_fs()
fi
}
+# check the remote server ip address tpye
+is_ipv6_target()
+{
+ local _server _server_tmp
+
+ if is_ssh_dump_target; then
+ _server=`get_option_value ssh`
+ elif is_nfs_dump_target; then
+ _server=`get_option_value nfs`
+ fi
+
+ [ -z "$_server" ] && return 1
+ # in ipv6, the _server format is [xxxx:xxxx::xxxx%eth0]:/mnt/nfs or
+ # username@xxxx:xxxx::xxxx%eth0. what we need is just xxxx:xxxx::xxxx
+ _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 ":"
+}
--
1.8.4.2
9 years, 5 months
[PATCH v5] Enhance kdump to support ipv6
by Arthur Zou
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(a)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()
{
--
1.8.4.2
9 years, 5 months
[PATCH v3] kdump-module-setup.sh: Handle static IPs defined in NetworkManager gui
by Marc Milgram
NetworkManager changed the format of ifcfg-device files. They may define
static IP addresses with the following format:
IPADDR0=192.168.122.100
PREFIX0=24
There may be up to 255 ip addresses for a network device - each with a unique
number tagged to the end of IPADDR and PREFIX.
Prior to this fix, kdump only handled static ip addresses defined with
IPADDR=192.168.122.100
PREFIX=24
ie. without the number.
The solution is to use "ip" commands to find the correct network information.
Tested with both static and dynamic IP addresses.
v2: Fixed a local variable that was set incorrectly
v3: Fix iscsi case
Signed-off-by: Marc Milgram <mmilgram(a)redhat.com>
---
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 2a16900..87ad072 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -67,14 +67,17 @@ kdump_setup_dns() {
}
#$1: netdev name
-#checking /etc/sysconfig/network-scripts/ifcfg-$1,
+#$2: srcaddr
#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" ] && \
- NETMASK=$(ipcalc -m $IPADDR/$PREFIX | cut -d'=' -f2)
- echo -n "${IPADDR}::${GATEWAY}:${NETMASK}::"
+ local _netmask _gateway
+ local _netdev="$1" _srcaddr="$2"
+ local _ipaddr=$(ip addr show dev $_netdev permanent | \
+ awk "/ $_srcaddr\/.* $_netdev\$/{print \$2}")
+ if [ -n "$_ipaddr" ]; then
+ _netmask=$(ipcalc -m $_ipaddr | cut -d'=' -f2)
+ _gateway=$(ip route list dev $_netdev | awk '/^default /{print $3}')
+ echo -n "${_srcaddr}::${_gateway}:${_netmask}::"
fi
}
@@ -181,7 +184,7 @@ kdump_setup_znet() {
# Setup dracut to bringup a given network interface
kdump_setup_netdev() {
- local _netdev=$1
+ local _netdev=$1 _srcaddr=$2
local _static _proto _ip_conf _ip_opts _ifname_opts
if [ "$(uname -m)" = "s390x" ]; then
@@ -189,7 +192,7 @@ kdump_setup_netdev() {
fi
_netmac=$(kdump_get_mac_addr $_netdev)
- _static=$(kdump_static_ip $_netdev)
+ _static=$(kdump_static_ip $_netdev $_srcaddr)
if [ -n "$_static" ]; then
_proto=none
else
@@ -223,8 +226,9 @@ kdump_setup_netdev() {
#Function:kdump_install_net
#$1: config values of net line in kdump.conf
+#$2: srcaddr of network device
kdump_install_net() {
- local _server _netdev
+ local _server _netdev _srcaddr
local config_val="$1"
_server=`echo $config_val | sed 's/.*@//' | cut -d':' -f1`
@@ -239,13 +243,15 @@ kdump_install_net() {
if [ -n "`echo $_netdev | grep via`" ]
then
# we are going to a different subnet
+ _srcaddr=`echo $_netdev|awk '{print $7}'|head -n 1`
_netdev=`echo $_netdev|awk '{print $5;}'|head -n 1`
else
# we are on the same subnet
+ _srcaddr=`echo $_netdev|awk '{print $5}'|head -n 1`
_netdev=`echo $_netdev|awk '{print $3}'|head -n 1`
fi
- kdump_setup_netdev "${_netdev}"
+ kdump_setup_netdev "${_netdev}" "${_srcaddr}"
#save netdev used for kdump as cmdline
# Whoever calling kdump_install_net() is setting up the default gateway,
@@ -364,6 +370,7 @@ kdump_setup_iscsi_device() {
local username; local password; local userpwd_str;
local username_in; local password_in; local userpwd_in_str;
local netdev
+ local srcaddr
local idev
local netroot_str ; local initiator_str;
local netroot_conf="${initdir}/etc/cmdline.d/50iscsi.conf"
@@ -398,9 +405,11 @@ 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' | awk '{ print $1; exit }')
+ sed 's|.*dev \(.*\).*|\1|g')
+ srcaddr=$(echo $netdev | awk '{ print $3; exit }')
+ netdev=$(echo $netdev | awk '{ print $1; exit }')
- kdump_setup_netdev $netdev
+ kdump_setup_netdev $netdev $srcaddr
# prepare netroot= command line
# FIXME: IPV6 addresses require explicit [] around $tgt_ipaddr
9 years, 5 months
[PATCH v4] Enhance kdump to support ipv6
by Arthur Zou
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(a)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()
{
--
1.8.4.2
9 years, 5 months
[PATCH] makedumpfile: Fix Makefile for eppic_makedumpfile.so build
by WANG Chao
Backport from the following commit from upstream makedumpfile:
commit 45fc42c
Author: WANG Chao <chaowang(a)redhat.com>
Date: Tue Jun 10 14:11:27 2014 +0900
[PATCH] Fix Makefile for eppic_makedumpfile.so build.
When libeppic isn't installed on a standard location, building
eppic_makedumpfile.so with -leppic directly doesn't work.
Add LDFLAGS to build arguments, so that one can pass LDFLAGS="-Ldir
-Idir" to tell where to search for libeppic library and its header
files.
For example, if eppic source is installed on the same directory level
with makedumpfile as the following:
makedumpfile
|--- arch
+--- eeppic_scripts
eppic
|--- applications
+--- libeppic
After compiling libeppic, one can use the following command to build
eppic_makedumpfile.so:
make LDFLAGS="-I../eppic/libeppic -L../eppic/libeppic" eppic_makedumpfile.so
Signed-off-by: WANG Chao <chaowang(a)redhat.com>
With this patch, we don't need use a fedora-specific patch for building
eppic_makedumpfile.so.
Signed-off-by: WANG Chao <chaowang(a)redhat.com>
---
....3-build-makedumpfile-eppic-shared-object.patch | 20 ---------
...-Makefile-for-eppic_makedumpfile.so-build.patch | 48 ++++++++++++++++++++++
kexec-tools.spec | 5 ++-
3 files changed, 51 insertions(+), 22 deletions(-)
delete mode 100644 kexec-tools-2.0.3-build-makedumpfile-eppic-shared-object.patch
create mode 100644 kexec-tools-2.0.4-makedumpfile-Fix-Makefile-for-eppic_makedumpfile.so-build.patch
diff --git a/kexec-tools-2.0.3-build-makedumpfile-eppic-shared-object.patch b/kexec-tools-2.0.3-build-makedumpfile-eppic-shared-object.patch
deleted file mode 100644
index 775511a..0000000
--- a/kexec-tools-2.0.3-build-makedumpfile-eppic-shared-object.patch
+++ /dev/null
@@ -1,20 +0,0 @@
---- kexec-tools-2.0.6/makedumpfile-1.5.6/Makefile.orig
-+++ kexec-tools-2.0.6/makedumpfile-1.5.6/Makefile
-@@ -66,7 +66,7 @@
- CFLAGS += -DUSESNAPPY
- endif
-
--all: makedumpfile
-+all: makedumpfile eppic_makedumpfile.so
-
- $(OBJ_PART): $(SRC_PART)
- $(CC) $(CFLAGS) -c -o ./$@ $(VPATH)$(@:.o=.c)
-@@ -87,7 +87,7 @@
- gzip -c ./makedumpfile.conf.5 > ./makedumpfile.conf.5.gz
-
- eppic_makedumpfile.so: extension_eppic.c
-- $(CC) $(CFLAGS) -shared -rdynamic -o $@ extension_eppic.c -fPIC -leppic -ltinfo
-+ $(CC) $(CFLAGS) -shared -rdynamic -o $@ extension_eppic.c -I../eppic/libeppic -fPIC ../eppic/libeppic/libeppic.a -ltinfo
-
- clean:
- rm -f $(OBJ) $(OBJ_PART) $(OBJ_ARCH) makedumpfile makedumpfile.8.gz makedumpfile.conf.5.gz
diff --git a/kexec-tools-2.0.4-makedumpfile-Fix-Makefile-for-eppic_makedumpfile.so-build.patch b/kexec-tools-2.0.4-makedumpfile-Fix-Makefile-for-eppic_makedumpfile.so-build.patch
new file mode 100644
index 0000000..5960331
--- /dev/null
+++ b/kexec-tools-2.0.4-makedumpfile-Fix-Makefile-for-eppic_makedumpfile.so-build.patch
@@ -0,0 +1,48 @@
+From 45fc42c5c980e2d5b755ed24a6983f44798d958e Mon Sep 17 00:00:00 2001
+From: WANG Chao <chaowang(a)redhat.com>
+Date: Tue, 10 Jun 2014 14:11:27 +0900
+Subject: [PATCH] [PATCH] Fix Makefile for eppic_makedumpfile.so build.
+
+When libeppic isn't installed on a standard location, building
+eppic_makedumpfile.so with -leppic directly doesn't work.
+
+Add LDFLAGS to build arguments, so that one can pass LDFLAGS="-Ldir
+-Idir" to tell where to search for libeppic library and its header
+files.
+
+For example, if eppic source is installed on the same directory level
+with makedumpfile as the following:
+
+makedumpfile
+ |--- arch
+ +--- eeppic_scripts
+eppic
+ |--- applications
+ +--- libeppic
+
+After compiling libeppic, one can use the following command to build
+eppic_makedumpfile.so:
+
+make LDFLAGS="-I../eppic/libeppic -L../eppic/libeppic" eppic_makedumpfile.so
+
+Signed-off-by: WANG Chao <chaowang(a)redhat.com>
+---
+ Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index d87638b..0cc07ef 100644
+--- a/Makefile
++++ b/Makefile
+@@ -87,7 +87,7 @@ makedumpfile: $(SRC_BASE) $(OBJ_PART) $(OBJ_ARCH)
+ gzip -c ./makedumpfile.conf.5 > ./makedumpfile.conf.5.gz
+
+ eppic_makedumpfile.so: extension_eppic.c
+- $(CC) $(CFLAGS) -shared -rdynamic -o $@ extension_eppic.c -fPIC -leppic -ltinfo
++ $(CC) $(CFLAGS) $(LDFLAGS) -shared -rdynamic -o $@ extension_eppic.c -fPIC -leppic -ltinfo
+
+ clean:
+ rm -f $(OBJ) $(OBJ_PART) $(OBJ_ARCH) makedumpfile makedumpfile.8.gz makedumpfile.conf.5.gz
+--
+1.9.3
+
diff --git a/kexec-tools.spec b/kexec-tools.spec
index c2434b9..9230ccf 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -75,7 +75,7 @@ ExcludeArch: aarch64
# Patches 601 onward are generic patches
#
Patch601: kexec-tools-2.0.3-disable-kexec-test.patch
-Patch604: kexec-tools-2.0.3-build-makedumpfile-eppic-shared-object.patch
+Patch602: kexec-tools-2.0.4-makedumpfile-Fix-Makefile-for-eppic_makedumpfile.so-build.patch
%description
kexec-tools provides /sbin/kexec binary that facilitates a new
@@ -112,7 +112,7 @@ tar -z -x -v -f %{SOURCE23}
%patch601 -p1
-%patch604 -p1
+%patch602 -p1
tar -z -x -v -f %{SOURCE13}
@@ -137,6 +137,7 @@ make
%ifarch %{ix86} x86_64 ppc64 s390x
make -C eppic/libeppic
make -C makedumpfile-1.5.6 LINKTYPE=dynamic USELZO=on USESNAPPY=on
+make -C makedumpfile-1.5.6 LDFLAGS="-I../eppic/libeppic -L../eppic/libeppic" eppic_makedumpfile.so
%endif
make -C kexec-tools-po
make -C kdump-anaconda-addon/po
--
1.9.3
9 years, 5 months
[PATCH v2] kdumpctl: time out after 180 seconds when connecting to ssh host
by WANG Chao
When starting kdump service with dump target being ssh host, after
network-online.target, we connect to ssh host and touch the dump
directory to make sure the host is ready to be dumped to.
Chances are after network-online.target, the particular network resource
we interest in isn't ready for connecting to the specified ssh host.
And at that time, we connect to ssh host and fail.
What we should do is to wait for the specific network resource, not
totally depending on network-online.target. But it's relatively
complicated to implement. A simple and direct solution would be try as
many time as it needs to connect to the configured ssh host. However to
avoid a infinitely loop, we time out and fail. I set this time out value
to be 180 seconds, and general speaking, 180 seconds would be enough for
almost any kind of network to be up and ready.
Vivek:
- sleep 2 seconds after each retry.
- output a brief message for each retry/failure.
Signed-off-by: WANG Chao <chaowang(a)redhat.com>
---
kdumpctl | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/kdumpctl b/kdumpctl
index 9cae0c4..5e4b1b0 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -381,9 +381,23 @@ function check_ssh_config()
function check_ssh_target()
{
local _ret
- ssh -q -i $SSH_KEY_LOCATION -o BatchMode=yes $DUMP_TARGET mkdir -p $SAVE_PATH
- _ret=$?
+ local _start _delta
+
+ # Timeout out after 180 seconds, hopefully it's enough.
+ _start=$(date +%s)
+ while : ; do
+ ssh -q -i $SSH_KEY_LOCATION -o BatchMode=yes $DUMP_TARGET mkdir -p $SAVE_PATH
+ _ret=$?
+ _delta=$(($(date +%s) - $_start))
+ if [[ $_ret -eq 0 || $_delta -gt 180 ]]; then
+ break
+ fi
+ echo "ssh to $DUMP_TARGET failed. Will retry after 2 seconds"
+ sleep 2
+ done
+
if [ $_ret -ne 0 ]; then
+ echo "ssh failed after multiple tries"
echo "Could not create $DUMP_TARGET:$SAVE_PATH, you probably need to run \"kdumpctl propagate\"" >&2
return 1
fi
--
1.9.3
9 years, 6 months