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, 4 months
[PATCH] Hardware iSCSI support
by WANG Chao
Currently we retrieve all the necessary information of an iSCSI session
and pass them to 2nd kernel. This is wrong way to go for hardware iscsi,
because dracut has already had its own infrastructure to do bring up any
iscsi device configured in firmware of an HBA (Host Bus Bridge).
This patch will determine if an iscsi session is established by firmware
configured iscsi. If it does, then we don't pass anything down to 2nd
kernel. dracut will handle it.
I read some iscsi code and I also talked with storage QE. It's confirmed
that software iscsi will use "tcp" transport class while hardware iscsi
will use like "be2iscsi" "bnx2i" transport class. It's ok to use
the transport name of an iface of a scsi session to determine hardware
iscsi or not. Additionally using "iscsi_firmware" "rd.iscsi.firmware" to
determine if the system is iscsi boot, because dracut can only handle
this case.
Along this patch, I add the infrastructure of determine iBFT, but it's
not complete yet. Mark the part as "FIXME". Once customer is asking or
maybe I get hold of iBFT box, I can start working on it.
Signed-off-by: WANG Chao <chaowang(a)redhat.com>
---
dracut-module-setup.sh | 77 +++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 76 insertions(+), 1 deletion(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index dcebc47..9616866 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -411,7 +411,78 @@ kdump_get_iscsi_initiator() {
return 1
}
-# No ibft handling yet.
+# Determine hardware iscsi by an iface's transport class.
+# If transport class is tcp, it's software iscsi.
+# If it's be2iscsi, bnx2i, cxgb3i, cxgb4i, it's hardware iscsi.
+kdump_is_iscsi_hw_session() {
+ if [ "$(kdump_iscsi_get_rec_val $1 "iface.transport_name")" = tcp ]; then
+ return 1
+ fi
+
+ return 0
+}
+
+# FIXME: determine iBFT
+kdump_is_iscsi_ibft_session() {
+ return 1
+}
+
+# kernel cmdline must contain these either of the following arguments
+# for booting off hardware iSCSI:
+# rd.iscsi.firmware[=1], iscsi_firmware
+kdump_is_iscsi_hw_cmdline() {
+ local cmdline
+
+ cmdline="$(cat /proc/cmdline)"
+
+ for arg in $cmdline; do
+ case "$arg" in
+ "rd.iscsi.firmware" |\
+ "rd.iscsi.firmware=1" |\
+ "iscsi_firmware")
+ return 0
+ ;;
+ esac
+ done
+
+ return 1
+}
+
+# kernel cmdline must contain these either of the following arguments
+# for booting off iBFT:
+# rd.iscsi.ibft[=1], ip=ibft
+kdump_is_iscsi_ibft_cmdline() {
+ local cmdline
+
+ cmdline="$(cat /proc/cmdline)"
+
+ for arg in $cmdline; do
+ case "$arg" in
+ "rd.iscsi.ibft" |\
+ "rd.iscsi.ibft=1" |\
+ "ip=ibft")
+ return 0
+ ;;
+ esac
+ done
+
+ return 1
+}
+
+# Sanity check if an iscsi session is established by iBFT or firmware
+kdump_is_iscsi_fw() {
+
+ if kdump_is_iscsi_hw_cmdline && kdump_is_iscsi_hw_session $1; then
+ return 0
+ fi
+
+ if kdump_is_iscsi_ibft_cmdline && kdump_is_iscsi_ibft_session $1; then
+ return 0
+ fi
+
+ return 1
+}
+
kdump_setup_iscsi_device() {
local path=$1
local tgt_name; local tgt_ipaddr;
@@ -434,6 +505,10 @@ kdump_setup_iscsi_device() {
return 1
fi
+ if kdump_is_iscsi_fw ${path}; then
+ return 0;
+ fi
+
tgt_name=$(kdump_iscsi_get_rec_val ${path} "node.name")
tgt_ipaddr=$(kdump_iscsi_get_rec_val ${path} "node.conn\[0\].address")
--
1.9.3
8 years, 10 months
[PATCH v2] Enhance kdump to support ipv6
by Minfei Huang
From: Arthur Zou <zzou(a)redhat.com>
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 at fe80::5054:ff:fe48:ca80%eth0"
else /etc/kdump.conf should be edited like "ssh root at 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>
Signed-off-by: Minfei Huang <mhuang(a)redhat.com>
---
dracut-kdump.sh | 8 ++++--
dracut-module-setup.sh | 67 ++++++++++++++++++++++++++++++++++++--------------
kdump-lib.sh | 33 +++++++++++++++++++++++++
3 files changed, 88 insertions(+), 20 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh
index 600e84e..9f12084 100755
--- a/dracut-kdump.sh
+++ b/dracut-kdump.sh
@@ -121,9 +121,13 @@ 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 38801de..d39b127 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -70,14 +70,24 @@ 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
/sbin/ip route show | grep -v default | grep "^[[:digit:]].*via.* $_netdev " |\
@@ -264,24 +274,43 @@ kdump_install_net() {
local _server _netdev _srcaddr
local config_val="$1"
- _server=`echo $config_val | sed 's/.*@//' | cut -d':' -f1`
+ _server=`get_remote_host $config_val`
- _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`" ]
- 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`
+ if is_ipv6_target; then
+ #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}"
@@ -583,6 +612,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 "/lib/kdump/kdump-lib.sh" "/lib/kdump-lib.sh"
diff --git a/kdump-lib.sh b/kdump-lib.sh
index a20c6e8..5053fdd 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -138,3 +138,36 @@ check_save_path_fs()
fi
}
+# get ip address or hostname from nfs/ssh config value
+get_remote_host()
+{
+ local _config_val=$1
+
+ # in ipv6, the _config_val format is [xxxx:xxxx::xxxx%eth0]:/mnt/nfs or
+ # username at xxxx:xxxx::xxxx%eth0. what we need is just xxxx:xxxx::xxxx
+ _config_val=${_config_val#*@}
+ _config_val=${_config_val%:/*}
+ _config_val=${_config_val#[}
+ _config_val=${_config_val%]}
+ _config_val=${_config_val%\%*}
+ echo $_config_val
+}
+
+# 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
+ _server=`get_remote_host $_server`
+ _server_tmp=$_server
+ _server=`getent hosts $_server | head -n 1 | cut -d' ' -f1`
+ _server=${_server:-$_server_tmp}
+ echo $_server | grep -q ":"
+}
--
1.8.3.1
8 years, 11 months
[PATCH] Fix an installation issue on ppc64le
by WANG Chao
I forgot to add kdump.sysconfig.ppc64le to "Source" directive to
kexec-tools.spec. And on ppc64le, the default kdump.sysconfig will be
installed to /etc/sysconfig/kdump. Now fix it.
Signed-off-by: WANG Chao <chaowang(a)redhat.com>
---
kexec-tools.spec | 1 +
1 file changed, 1 insertion(+)
diff --git a/kexec-tools.spec b/kexec-tools.spec
index 96d0466..599a636 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -26,6 +26,7 @@ Source21: kdump-in-cluster-environment.txt
Source22: kdump-dep-generator.sh
Source23: kdump-anaconda-addon-005.tar.gz
Source24: kdump-lib-initramfs.sh
+Source25: kdump.sysconfig.ppc64le
#######################################
# These are sources for mkdumpramfs
--
1.9.3
8 years, 11 months
[PATCH v2] kdump-lib: fix get_option_value()
by WANG Chao
get_option_value() is used to get the value of $1 configured in
/etc/kdump.conf. But when we use "get_option_value ssh", it can get the
value of "sshkey" instead of "ssh".
Fix the regexp pattern to get an exact match.
Signed-off-by: WANG Chao <chaowang(a)redhat.com>
---
kdump-lib.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index a20c6e8..b9dec21 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -109,7 +109,7 @@ get_mntpoint_from_target()
# get_option_value <option_name>
# retrieves value of option defined in kdump.conf
get_option_value() {
- echo $(strip_comments `grep ^$1 /etc/kdump.conf | tail -1 | cut -d\ -f2-`)
+ echo $(strip_comments `grep "^$1[[:space:]]\+" /etc/kdump.conf | tail -1 | cut -d\ -f2-`)
}
#This function compose a absolute path with the mount
--
1.9.3
8 years, 11 months
[PATCH] kexec-kdump-howto: Add the instruction of the dasd on System-z
by Minfei Huang
Some one has no idea how the kdump brings up the devices during the 2nd
kernel boots.
The initramfs contains the copy of /etc/dasd.conf, and the
kernel will bring up devices which specify in the /etc/dasd.conf.
Signed-off-by: Minfei Huang <mhuang(a)redhat.com>
---
kexec-kdump-howto.txt | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/kexec-kdump-howto.txt b/kexec-kdump-howto.txt
index 5582e40..0fd2a41 100644
--- a/kexec-kdump-howto.txt
+++ b/kexec-kdump-howto.txt
@@ -245,6 +245,11 @@ the Blade Management Console. Select the corresponding blade for which you want
to initate the dump and then click "Restart blade with NMI". This issues a
system reset and invokes xmon debugger.
+6) System-z specific methods:
+
+Specify the device option in the /etc/dasd.conf to bring up the device which
+you want during the kernel boots.
+
Advanced Setups:
--
1.8.3.1
8 years, 11 months
[PATCH v3] fix the corner case of static route
by Baoquan He
Previously for fixing the static route problem, all routes get through
a specific network interface will be saved and added in 2nd kernel.
Search pattern is used to get routes:
/sbin/ip route show | grep -v default | grep "^[[:digit:]].*via.* $_netdev"
An exception existed though, that is 2 machines connected directly and the
network interfaces wihch are configured as in different network subnets.
So in the v1 and v2, "ip route get to $target" command is executed and an
exact route to a target is saved and added in 2nd kernel. This works for
static route issue and can fix the corner case above.
v1:
Introduced the new way which get exact route to remote target.
v1->v2:
Since a grammer error which saved exact route, v2 is posted.
v2->v3:
Per Vivek's comment, route to target should not be related to
static ip issues. So in v3 introduced the get_routes function
and take it out of kdump_static_ip.
Baoquan He (1):
save exact route to remote target
dracut-module-setup.sh | 31 +++++++++++++++++++++++--------
1 file changed, 23 insertions(+), 8 deletions(-)
--
1.9.0
8 years, 11 months
[PATCH] mkdumprd: Enable the devices to make work for kdump in 2nd kernel
by Minfei Huang
From: mhuang <mhuang(a)redhat.com>
The device which is exclude by root device, must specify option in
/etc/dasd.conf to make it online on s390x when the machine is booting.
The kdump will fail to generate the vmcore in the 2nd kernel, if
the kdump target is not the root device.
In the initramfs, we will generate the config dasd.conf which contains
all of the online devices by sysfs.
Signed-off-by: mhuang <mhuang(a)redhat.com>
---
dracut-module-setup.sh | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 38801de..48307e6 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -569,6 +569,29 @@ kdump_install_random_seed() {
bs=$poolsize count=1 2> /dev/null
}
+specify_dasd_conf() {
+ local dasd_dev
+ local dasd_conf="${initdir}/etc/dasd.conf"
+
+ [[ -f $dasd_conf ]] || touch $dasd_conf
+
+ for dasd_dev in /sys/block/dasd*
+ do
+ if [ `cat $dasd_dev/device/online` -eq 1 ]; then
+ dasd_dev=$(basename $(readlink $dasd_dev/device))
+ if ! grep -q "$dasd_dev" $dasd_conf 2>/dev/null; then
+ echo $dasd_dev >> $dasd_conf
+ fi
+ fi
+ done
+}
+
+kdump_specify_conf() {
+ if [ "$(uname -m)" = "s390x" ]; then
+ specify_dasd_conf
+ fi
+}
+
install() {
kdump_install_conf
@@ -601,6 +624,8 @@ install() {
# target. Ideally all this should be pushed into dracut iscsi module
# at some point of time.
kdump_check_iscsi_targets
+
+ kdump_specify_conf
}
installkernel() {
--
1.8.3.1
8 years, 11 months
[PATCH] kdump: fix save vmcore path for fadump
by Hari Bathini
With fadump support, dracut-kdump.sh script is installed into default
initrd to capture vmcore generated by firmware assisted dump. Thus in
fadump case, the same initrd is being used for normal boot as well as
boot after system crash. Hence a device node, added by firmware while
system crashes, is checked to identify if it is a normal boot or boot
after crash to determine whether or not capture vmcore. While testing
fadump in fedora21 alpha, observed that vmcore capture is initiated
even during normal boot, inspite of this check, with the below error:
"kdump.sh[451]: /bin/kdump.sh: line 5: return: can only `return'
from a function or sourced script"
The below patch tries to fix this issue.
Signed-off-by: Hari Bathini <hbathini(a)linux.vnet.ibm.com>
---
dracut-kdump.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh
index 600e84e..4fef0c5 100755
--- a/dracut-kdump.sh
+++ b/dracut-kdump.sh
@@ -2,7 +2,7 @@
# continue here only if we have to save dump.
if [ -f /etc/fadump.initramfs ] && [ ! -f /proc/device-tree/rtas/ibm,kernel-dump ]; then
- return
+ exit 0
fi
exec &> /dev/console
8 years, 11 months
[PATCH] kdump-lib: fix get_option_value()
by WANG Chao
get_option_value() is used to get the value of $1 configured in
/etc/kdump.conf. But when we use "get_option_value ssh", it can get the
value of "sshkey" instead of "ssh".
Fix it by adding "-w" option to grep to get the match for the exact
word.
Signed-off-by: WANG Chao <chaowang(a)redhat.com>
---
kdump-lib.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index a20c6e8..df080e5 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -109,7 +109,7 @@ get_mntpoint_from_target()
# get_option_value <option_name>
# retrieves value of option defined in kdump.conf
get_option_value() {
- echo $(strip_comments `grep ^$1 /etc/kdump.conf | tail -1 | cut -d\ -f2-`)
+ echo $(strip_comments `grep -w ^$1 /etc/kdump.conf | tail -1 | cut -d\ -f2-`)
}
#This function compose a absolute path with the mount
--
1.9.3
8 years, 11 months