Commit Graph

22 Commits

Author SHA1 Message Date
Dave Young
8770ac2d6f revert explictly handling of PIPESTATUS
To simplify the code logic, remove the previous PIPESTATUS handling because
previous patch "enable pipefail bash option" added pipefail option which will
also resolve this issue.

This is a reverting of below commit:
commit 3111ff74c9
Author: Chao Wang <chaowang@redhat.com>
Date:   Mon Aug 6 14:49:52 2012 +0800

    Change return value to indicate the result of dump_raw() correctly.

    Resolves bz845916.
    For raw dump code below:
    $CORE_COLLECTOR /proc/vmcore | dd of=$1 bs=$DD_BLKSIZE >> /tmp/dd_progress_f
    in case pipe fails it will still return 0, Fix this by return the PIPESTATUS

    Signed-off-by: Chao Wang <chaowang@redhat.com>
    Acked-by: Dave Young <dyoung@redhat.com>

Signed-off-by: Dave Young <dyoung@redhat.com>
Acked-by: Baoquan He <bhe@redhat.com>
2012-12-21 11:33:30 +08:00
Dave Young
e36d4ab60d enable pipefail bash option
Follwing code will not return 1 if CORE_COLLECTOR /proc/vmcore fail:
$CORE_COLLECTOR /proc/vmcore | ssh $_opt $2 "dd bs=512 of=$_dir/vmcore-incomplete" || return 1

Fix it by enabling pipefail option

Tested in F18 with ssh dump.

Signed-off-by: Dave Young <dyoung@redhat.com>
Acked-by: Baoquan He <bhe@redhat.com>
2012-12-21 11:33:07 +08:00
Baoquan He
3be6c1228e change the dump dir format to be more readable
Resolves: bz880551

Currently on fedora directory name of kdump is like 14.11.12-03:40:30.
It's not as readable as RHEL6. The old format of dir is host_ip-date-time.
This patch changes it back like ole one as below.
192.168.122.234-2012-10-31-05:17:20

If can't get HOST_IP for a network kudmp, we just fail. Becasue most
likely any attempt to save dump will also fail.

Signed-off-by: Baoquan He <bhe@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
2012-12-14 17:23:09 +08:00
Dave Young
c5c4a7b8b0 add random feeding code for ssh dump
ssh: add random feeding code

openssh usually depends on /dev/urandom to seeding PRNG (pseudo-random number
generator). To ensure there's sufficient entropy just feed /dev/urandom with
saved /var/lib/random-seed which is saved in installing phase.

dracut_install will print error message, so just exit and do not print error
again.

Todo: other dracut_install fail and exit, such as dd, makedumpfile.

[v2->v3]: use [[:blank:]] for whitespace checking.

Signed-off-by: Dave Young <dyoung@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
2012-11-16 14:07:52 +08:00
Dave Young
f3914a98a6 kdump option space checking improvement
We can use not only space but also tab as whitespace,
so s/\ /[[:blank:]] for checking the whitespace

The last commit is intend for checking multiple dump target,
and differentiate ssh and sshkey options. This issue is only
for ssh, so no need to add [[:blank:]] for other dump types to
create a very long code line.

[v1->v2]: use [[:blank:]] instead of [[:space:]]
see expanation in below doc:
http://en.wikipedia.org/wiki/Regular_expression#POSIX_character_classes
[:blank:] 	[ \t] 	Space and tab
[:space:]	[ \t\r\n\v\f] 	Whitespace characters

Tested the [:blank:] works well as [:space:]

Signed-off-by: Dave Young <dyoung@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
CC: Cong Wang <amwang@redhat.com>
2012-11-16 14:06:26 +08:00
Dave Young
9d161703a6 pass persistent name to dracut --mount
currently --mount param are retrieved from /proc/mounts, but the device
name could be renamed in initramfs. So here convert them to persistent
names before passing to dracut

lvm canonical dev name is /dev/mapper/lvname-link which will be showed
in /proc/mounts
here fix get_mp function by using findmnt utils to find the mount point.

This patch depends on below dracut patch:
http://permalink.gmane.org/gmane.linux.kernel.initramfs/2903

[chaowang]:
in case device is not mounted we should not echo the mount line in to_mount()
use findmnt -n to strip the header line
for nfs don't pass persistent name to dracut
[vivek]:
improve variable names

Signed-off-by: Dave Young <dyoung@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
2012-09-20 11:03:19 +08:00
Dave Young
7f9d4f917a remove useless uuid and label handling
When we intall kdump.conf to initramfs we have converted the UUID and LABEL
to device name. So in initramfs these convert code is not used indeed.

Signed-off-by: Dave Young <dyoung@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
2012-09-20 11:03:04 +08:00
Chao Wang
3111ff74c9 Change return value to indicate the result of dump_raw() correctly.
Resolves bz845916.
For raw dump code below:
$CORE_COLLECTOR /proc/vmcore | dd of=$1 bs=$DD_BLKSIZE >> /tmp/dd_progress_file 2>&1 || return 1
in case pipe fails it will still return 0, Fix this by return the PIPESTATUS[0] at the end of this fuction.

Signed-off-by: Chao Wang <chaowang@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
2012-08-07 13:18:54 +08:00
Dave Young
d1d0feddf9 call dracut function for default shell
Kdump dracut hooks need to enter emergency shell, currently it directly call
"sh -i -l", with recent dracut this does not work anymore without proper ctty.

change to call dracut lib function _emergency_shell instead of directly call
'sh -i -l'

This patch depends on dracut patch:
http://permalink.gmane.org/gmane.linux.kernel.initramfs/2821

Signed-off-by: Dave Young <dyoung@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
2012-08-07 13:17:50 +08:00
Dave Young
b47c0915d2 refactor net option
Currently net options means either nfs or ssh dump.
Better to split these two into standalone options. That's more clear to user.

after the split, ssh dump need user specify "ssh user@host"
nfs dump need user specify "nfs host:nfsshare"

Signed-off-by: Dave Young <dyoung@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
2012-07-23 15:31:28 +08:00
Dave Young
5e85d20d34 use fstab-sys to mount nfs
dump_nfs mount the nfs share to /mnt, it's not what we expected.
Change to use dracut fstab mount infrastructure for this.
After the fix nfs dump is just same as localfs dump.

The --mount for nfs does not work before, it depend on the upstream patch:
1. dracut fix to autoload nfs.ko in case nfs4. the patch post as below:
http://permalink.gmane.org/gmane.linux.kernel.initramfs/2768

Signed-off-by: Dave Young <dyoung@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
2012-07-23 15:31:22 +08:00
Dave Young
a49b0881a8 rename function dump_localfs
nfs will be handled in fstab-sys as well as localfs.
so rename dump_localfs to dump_fs firstly.

Signed-off-by: Dave Young <dyoung@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
2012-07-23 15:31:15 +08:00
Dave Young
3d470c4be2 dump_localfs error path fix
in dump_localfs, we should error out if fstab mount fails
Also error out if mkdir fails.

vivek: display error message for debugging purpose.

Signed-off-by: Dave Young <dyoung@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
2012-07-23 15:31:08 +08:00
Dave Young
4e4a173698 Add kdump_post and kdump_pre support
Original patch is from Amerigo, but it has changed a lot:
remove multi dump
refreshed with latest git for the dump instruction function restructure
fixed the behavior of do_kdump_pre, if kdump_pre fails it will reboot
update the docs
check the existance and executable of kdump_pre/post files,
also check the timestamp of them for rebuilding.

refresh patch,
Address comments from vivek:
s/hush/bash in docs
fix the copy-paste error in kdump post error message
s/reboot\/halt/reboot in kexec-kdump-howto.txt

Signed-off-by: Dave Young <dyoung@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
2012-06-14 09:57:30 +08:00
Dave Young
b30eb78ab2 raw core_collector fix
1. only append '-F' for default core_collector internally
2. error out if user does not add '-F' for makedumpfile

v1->v2: refresh because of new core collector verify function
v2->v3: optimize the code, remove local variable for default core_collector

Signed-off-by: Dave Young <dyoung@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
2012-06-14 09:57:07 +08:00
Dave Young
2697669fa9 ssh core_collector fix
1. add core_collector filter support to ssh dump
2. scp can be specified in kdump.conf
3. error out if no '-F' with makedumpfile
4. add proper explanation and examples to kdump.conf[.5] and kexec-kdump-howto.txt.

v1->v2: add verify_core_collector function
v2->v3: optimize the code, remove local variable for default core_collector

Signed-off-by: Dave Young <dyoung@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
2012-06-14 09:56:10 +08:00
Dave Young
33d933f800 drcut-kdump.sh: cleanup kdump.conf check
move conf_file as a global variable to the top.
vivek: return earlier if kdump.conf is not found in read_kdump_conf to
avoid the deep indent.

Signed-off-by: Dave Young <dyoung@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
2012-06-14 09:55:54 +08:00
Dave Young
5d1bd77aed cleanup DUMP_INSTRUCTION handling
let add_dump_code only deal with real dump instruction,
move other logic out of that function, so it's easier for future features
like kdump_pre and kdump_post.

Signed-off-by: Dave Young <dyoung@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
2012-06-12 09:42:39 +08:00
Dave Young
6f312004e9 final reboot behavior fix
default action is handled in DUMP_INSTRUCTIONI. If default_action failed
current logic will cause mount_root_run_init, It does not make much sense.

changes to: let reboot -f does not depend on return status of DUMP_INSTRUCTION

Signed-off-by: Dave Young <dyoung@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
2012-06-12 09:42:35 +08:00
Dave Young
d5bc608abd dump_rootfs for default target fix
Do not reboot in dump_rootfs function, also do not directly call dump_rootfs
for default dump. Instead just adding it to DUMP_INSTRUCTION as other
user specified dump target.

Signed-off-by: Dave Young <dyoung@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
2012-06-12 09:42:29 +08:00
Dave Young
e27c9f6c52 do_default_action cleanup
Resolves: bz805773

simplify logic and remove redundant code:
put do_default_action to add_dump_code

Signed-off-by: Dave Young <dyoung@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
2012-05-14 10:20:29 +08:00
Dave Young
bbd2e7d30a remove dracut-files.tbz2 [v2]
Resolves: bz816864

currently kexec-tools maintains kdump dracut modules as below dir hierarchy:
 [dave@localhost fedpkg]$ tree kexec-tools/kdump_dracut_modules
 kexec-tools/kdump_dracut_modules
 `-- 99kdumpbase
     |-- kdump.sh
     `-- module-setup.sh

But in kexec-tools.spec, sources line is below:
Source100: dracut-files.tbz2

So we need to manually generate the dracut-files.tbz2, upload it, modify
the sources file which contains the md5sum of these binaies, and then do
the building. The more headache problem is this make local tests of
changes to kdump module hard.

To ease future work, move the files to TOPDIR, cp the sources instead.

Thanks for help from dzickus
[v1->v2]: Also remove dracut-files.tbz2 from sources file
          ChaoWang: add prefix to dracut files
2012-05-03 10:06:05 +08:00