This patch series mainly solves https://bugzilla.redhat.com/1451717
We collect all the kdump targets i.e. devices recognized under kdump, then improve kdump according to the type of the target.
E.g. If we know there is no crypt target, we can remove dracut "crypt" module, we only add rd.lvm.lv=X regarding the lvm target to kdump.
Xunlei Pang (7): kdump-lib.sh: fix improper get_block_dump_target() kdump-lib.sh: introduce get_kdump_targets() mkdumprd: change for_each_block_target() to use get_kdump_targets() kdumpctl: use generated rd.lvm.lv=X mkdumprd: omit crypt when there is no crypt kdump target mkdumprd: omit dracut modules in case of no lvm target mkdumprd: omit dracut modules in case of network dumping
kdump-lib.sh | 137 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---- kdumpctl | 52 ++++++++++++----------- mkdumprd | 106 +++++++++++++++++++++++---------------------- 3 files changed, 212 insertions(+), 83 deletions(-)
This patch improves get_block_dump_target as follows: -Consider block device in the special "--dracut-args --mount ..." in get_user_configured_dump_disk(). -Consider save path instead of root fs in get_block_dump_target(), and move it into kdump-lib.sh because we will have another user in the following patch. -For nfs/ssh dumping, there is no need to check the root device. -Move get_save_path into kdump-lib.sh.
After this patch, get_block_dump_target() can always return the correct block dump target specified.
Signed-off-by: Xunlei Pang xlpang@redhat.com --- kdump-lib.sh | 44 ++++++++++++++++++++++++++++++++++++-------- kdumpctl | 10 ---------- mkdumprd | 13 ------------- 3 files changed, 36 insertions(+), 31 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 8ebad70..2ddeb3e 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -44,12 +44,6 @@ is_fs_dump_target() egrep -q "^ext[234]|^xfs|^btrfs|^minix" /etc/kdump.conf }
-is_user_configured_dump_target() -{ - return $(is_mount_in_dracut_args || is_ssh_dump_target || is_nfs_dump_target || \ - is_raw_dump_target || is_fs_dump_target) -} - strip_comments() { echo $@ | sed -e 's/(.*)#.*/\1/' @@ -88,6 +82,12 @@ to_dev_name() { echo $dev }
+is_user_configured_dump_target() +{ + return $(is_mount_in_dracut_args || is_ssh_dump_target || is_nfs_dump_target || \ + is_raw_dump_target || is_fs_dump_target) +} + get_user_configured_dump_disk() { local _target @@ -97,9 +97,10 @@ get_user_configured_dump_disk() fi
_target=$(egrep "^ext[234]|^xfs|^btrfs|^minix|^raw" /etc/kdump.conf 2>/dev/null |awk '{print $2}') - [ -n "$_target" ] && echo $_target + [ -n "$_target" ] && echo $_target && return
- return + _target=$(get_dracut_args_target "$(grep "^dracut_args .*--mount" /etc/kdump.conf)") + [ -b "$_target" ] && echo $_target }
get_root_fs_device() @@ -111,6 +112,33 @@ get_root_fs_device() return }
+get_save_path() +{ + local _save_path=$(grep "^path" /etc/kdump.conf|awk '{print $2}') + if [ -z "$_save_path" ]; then + _save_path=$DEFAULT_PATH + fi + + echo $_save_path +} + +get_block_dump_target() +{ + local _target _path + + if is_ssh_dump_target || is_nfs_dump_target; then + return + fi + + _target=$(get_user_configured_dump_disk) + [ -n "$_target" ] && echo $(to_dev_name $_target) && return + + # Get block device name from local save path + _path=$(get_save_path) + _target=$(get_target_from_path $_path) + [ -b "$_target" ] && echo $(to_dev_name $_target) +} + # findmnt uses the option "-v, --nofsroot" to exclusive the [/dir] # in the SOURCE column for bind-mounts, then if $_mntpoint equals to # $_mntpoint_nofsroot, the mountpoint is not bind mounted directory. diff --git a/kdumpctl b/kdumpctl index e440bbb..0e53793 100755 --- a/kdumpctl +++ b/kdumpctl @@ -974,16 +974,6 @@ save_raw() return 0 }
-get_save_path() -{ - local _save_path=$(grep "^path" /etc/kdump.conf|awk '{print $2}') - if [ -z "$_save_path" ]; then - _save_path="/var/crash" - fi - - echo $_save_path -} - is_dump_target_configured() { local _target diff --git a/mkdumprd b/mkdumprd index 5a25853..45b185a 100644 --- a/mkdumprd +++ b/mkdumprd @@ -250,19 +250,6 @@ add_mount() { add_dracut_mount "$_mnt" }
-get_block_dump_target() -{ - local _target - - - _target=$(get_user_configured_dump_disk) - [ -n "$_target" ] && echo $(to_dev_name $_target) && return - - #get rootfs device name - _target=$(get_root_fs_device) - [ -b "$_target" ] && echo $(to_dev_name $_target) -} - #handle the case user does not specify the dump target explicitly handle_default_dump_target() {
Hi Xunlei, On 07/04/17 at 01:45pm, Xunlei Pang wrote:
This patch improves get_block_dump_target as follows: -Consider block device in the special "--dracut-args --mount ..." in get_user_configured_dump_disk(). -Consider save path instead of root fs in get_block_dump_target(), and move it into kdump-lib.sh because we will have another user in the following patch. -For nfs/ssh dumping, there is no need to check the root device. -Move get_save_path into kdump-lib.sh.
After this patch, get_block_dump_target() can always return the correct block dump target specified.
Signed-off-by: Xunlei Pang xlpang@redhat.com
kdump-lib.sh | 44 ++++++++++++++++++++++++++++++++++++-------- kdumpctl | 10 ---------- mkdumprd | 13 ------------- 3 files changed, 36 insertions(+), 31 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 8ebad70..2ddeb3e 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -44,12 +44,6 @@ is_fs_dump_target() egrep -q "^ext[234]|^xfs|^btrfs|^minix" /etc/kdump.conf }
-is_user_configured_dump_target() -{
- return $(is_mount_in_dracut_args || is_ssh_dump_target || is_nfs_dump_target || \
is_raw_dump_target || is_fs_dump_target)
-}
strip_comments() { echo $@ | sed -e 's/(.*)#.*/\1/' @@ -88,6 +82,12 @@ to_dev_name() { echo $dev }
+is_user_configured_dump_target() +{
- return $(is_mount_in_dracut_args || is_ssh_dump_target || is_nfs_dump_target || \
is_raw_dump_target || is_fs_dump_target)
+}
get_user_configured_dump_disk() { local _target @@ -97,9 +97,10 @@ get_user_configured_dump_disk() fi
In get_user_configured_dump_disk, we have also if is_ssh_dump_target || is_nfs_dump_target; then return fi
There are two places using get_user_configured_dump_disk, both of them check ssh/nfs targets first then call this get_user_configured_dump_disk
so we can drop the check within get_user_configured_dump_disk, it is safe since it just grep the fs/raw dump in kdump.conf.
_target=$(egrep "^ext[234]|^xfs|^btrfs|^minix|^raw" /etc/kdump.conf 2>/dev/null |awk '{print $2}')
- [ -n "$_target" ] && echo $_target
- [ -n "$_target" ] && echo $_target && return
- return
- _target=$(get_dracut_args_target "$(grep "^dracut_args .*--mount" /etc/kdump.conf)")
- [ -b "$_target" ] && echo $_target
}
get_root_fs_device() @@ -111,6 +112,33 @@ get_root_fs_device() return }
+get_save_path() +{
- local _save_path=$(grep "^path" /etc/kdump.conf|awk '{print $2}')
- if [ -z "$_save_path" ]; then
_save_path=$DEFAULT_PATH
- fi
- echo $_save_path
+}
+get_block_dump_target() +{
- local _target _path
- if is_ssh_dump_target || is_nfs_dump_target; then
return
- fi
- _target=$(get_user_configured_dump_disk)
- [ -n "$_target" ] && echo $(to_dev_name $_target) && return
- # Get block device name from local save path
- _path=$(get_save_path)
- _target=$(get_target_from_path $_path)
- [ -b "$_target" ] && echo $(to_dev_name $_target)
+}
# findmnt uses the option "-v, --nofsroot" to exclusive the [/dir] # in the SOURCE column for bind-mounts, then if $_mntpoint equals to # $_mntpoint_nofsroot, the mountpoint is not bind mounted directory. diff --git a/kdumpctl b/kdumpctl index e440bbb..0e53793 100755 --- a/kdumpctl +++ b/kdumpctl @@ -974,16 +974,6 @@ save_raw() return 0 }
-get_save_path() -{
- local _save_path=$(grep "^path" /etc/kdump.conf|awk '{print $2}')
- if [ -z "$_save_path" ]; then
_save_path="/var/crash"
- fi
- echo $_save_path
-}
is_dump_target_configured() { local _target diff --git a/mkdumprd b/mkdumprd index 5a25853..45b185a 100644 --- a/mkdumprd +++ b/mkdumprd @@ -250,19 +250,6 @@ add_mount() { add_dracut_mount "$_mnt" }
-get_block_dump_target() -{
- local _target
- _target=$(get_user_configured_dump_disk)
- [ -n "$_target" ] && echo $(to_dev_name $_target) && return
- #get rootfs device name
- _target=$(get_root_fs_device)
- [ -b "$_target" ] && echo $(to_dev_name $_target)
-}
#handle the case user does not specify the dump target explicitly handle_default_dump_target() { -- 1.8.3.1 _______________________________________________ kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org
Thanks Dave
On 07/04/2017 at 03:06 PM, Dave Young wrote:
Hi Xunlei, On 07/04/17 at 01:45pm, Xunlei Pang wrote:
This patch improves get_block_dump_target as follows: -Consider block device in the special "--dracut-args --mount ..." in get_user_configured_dump_disk(). -Consider save path instead of root fs in get_block_dump_target(), and move it into kdump-lib.sh because we will have another user in the following patch. -For nfs/ssh dumping, there is no need to check the root device. -Move get_save_path into kdump-lib.sh.
After this patch, get_block_dump_target() can always return the correct block dump target specified.
Signed-off-by: Xunlei Pang xlpang@redhat.com
kdump-lib.sh | 44 ++++++++++++++++++++++++++++++++++++-------- kdumpctl | 10 ---------- mkdumprd | 13 ------------- 3 files changed, 36 insertions(+), 31 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 8ebad70..2ddeb3e 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -44,12 +44,6 @@ is_fs_dump_target() egrep -q "^ext[234]|^xfs|^btrfs|^minix" /etc/kdump.conf }
-is_user_configured_dump_target() -{
- return $(is_mount_in_dracut_args || is_ssh_dump_target || is_nfs_dump_target || \
is_raw_dump_target || is_fs_dump_target)
-}
strip_comments() { echo $@ | sed -e 's/(.*)#.*/\1/' @@ -88,6 +82,12 @@ to_dev_name() { echo $dev }
+is_user_configured_dump_target() +{
- return $(is_mount_in_dracut_args || is_ssh_dump_target || is_nfs_dump_target || \
is_raw_dump_target || is_fs_dump_target)
+}
get_user_configured_dump_disk() { local _target @@ -97,9 +97,10 @@ get_user_configured_dump_disk() fi
In get_user_configured_dump_disk, we have also if is_ssh_dump_target || is_nfs_dump_target; then return fi
There are two places using get_user_configured_dump_disk, both of them check ssh/nfs targets first then call this get_user_configured_dump_disk
so we can drop the check within get_user_configured_dump_disk, it is safe since it just grep the fs/raw dump in kdump.conf.
Agree, will do
_target=$(egrep "^ext[234]|^xfs|^btrfs|^minix|^raw" /etc/kdump.conf 2>/dev/null |awk '{print $2}')
- [ -n "$_target" ] && echo $_target
- [ -n "$_target" ] && echo $_target && return
- return
- _target=$(get_dracut_args_target "$(grep "^dracut_args .*--mount" /etc/kdump.conf)")
- [ -b "$_target" ] && echo $_target
}
get_root_fs_device() @@ -111,6 +112,33 @@ get_root_fs_device() return }
+get_save_path() +{
- local _save_path=$(grep "^path" /etc/kdump.conf|awk '{print $2}')
- if [ -z "$_save_path" ]; then
_save_path=$DEFAULT_PATH
- fi
- echo $_save_path
+}
+get_block_dump_target() +{
- local _target _path
- if is_ssh_dump_target || is_nfs_dump_target; then
return
- fi
- _target=$(get_user_configured_dump_disk)
- [ -n "$_target" ] && echo $(to_dev_name $_target) && return
- # Get block device name from local save path
- _path=$(get_save_path)
- _target=$(get_target_from_path $_path)
- [ -b "$_target" ] && echo $(to_dev_name $_target)
+}
# findmnt uses the option "-v, --nofsroot" to exclusive the [/dir] # in the SOURCE column for bind-mounts, then if $_mntpoint equals to # $_mntpoint_nofsroot, the mountpoint is not bind mounted directory. diff --git a/kdumpctl b/kdumpctl index e440bbb..0e53793 100755 --- a/kdumpctl +++ b/kdumpctl @@ -974,16 +974,6 @@ save_raw() return 0 }
-get_save_path() -{
- local _save_path=$(grep "^path" /etc/kdump.conf|awk '{print $2}')
- if [ -z "$_save_path" ]; then
_save_path="/var/crash"
- fi
- echo $_save_path
-}
is_dump_target_configured() { local _target diff --git a/mkdumprd b/mkdumprd index 5a25853..45b185a 100644 --- a/mkdumprd +++ b/mkdumprd @@ -250,19 +250,6 @@ add_mount() { add_dracut_mount "$_mnt" }
-get_block_dump_target() -{
- local _target
- _target=$(get_user_configured_dump_disk)
- [ -n "$_target" ] && echo $(to_dev_name $_target) && return
- #get rootfs device name
- _target=$(get_root_fs_device)
- [ -b "$_target" ] && echo $(to_dev_name $_target)
-}
#handle the case user does not specify the dump target explicitly handle_default_dump_target() { -- 1.8.3.1 _______________________________________________ kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org
Thanks Dave
Resolves: bz1451717 https://bugzilla.redhat.com/1451717
We need to know all the kdump targets including the dump target and root in case of "dump_to_rootfs".
This is useful for us to do some extra work related to the type of different targets.
Signed-off-by: Xunlei Pang xlpang@redhat.com --- kdump-lib.sh | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ kdumpctl | 5 ----- mkdumprd | 12 ------------ 3 files changed, 51 insertions(+), 17 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 2ddeb3e..6b112a4 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -139,6 +139,57 @@ get_block_dump_target() [ -b "$_target" ] && echo $(to_dev_name $_target) }
+is_dump_to_rootfs() +{ + grep "^default[[:space:]]dump_to_rootfs" /etc/kdump.conf >/dev/null +} + +get_default_action_target() +{ + local _target + + if is_dump_to_rootfs; then + # Get rootfs device name + _target=$(get_root_fs_device) + [ -b "$_target" ] && echo $(to_dev_name $_target) && return + # Then, must be nfs root + echo "nfs" + fi +} + +# Get kdump targets(including root in case of dump_to_rootfs). +get_kdump_targets() +{ + local _target _root + local kdump_targets + + _target=$(get_block_dump_target) + if [ -n "$_target" ]; then + kdump_targets=$_target + elif is_ssh_dump_target; then + kdump_targets="ssh" + else + kdump_targets="nfs" + fi + + # Add the root device if dump_to_rootfs is specified. + _root=$(get_default_action_target) + if [ -n "$_root" -a "$kdump_targets" != "$_root" ]; then + kdump_targets="$kdump_targets $_root" + fi + + # NOTE: + # dracut parses devices from "/etc/fstab" with the "x-initrd.mount" option, + # which will be added as host_devs, it also includes usually simple devices + # (say mounted to /boot, /boot/efi/, etc) plus the root device. Then kdump + # must wait for these devices if initramfs is built with "--hostonly-cmdline". + # + # We don't pass "--hostonly-cmdline" to dracut, so there's no problem. + + echo "$kdump_targets" +} + + # findmnt uses the option "-v, --nofsroot" to exclusive the [/dir] # in the SOURCE column for bind-mounts, then if $_mntpoint equals to # $_mntpoint_nofsroot, the mountpoint is not bind mounted directory. diff --git a/kdumpctl b/kdumpctl index 0e53793..8c40564 100755 --- a/kdumpctl +++ b/kdumpctl @@ -171,11 +171,6 @@ check_kdump_cpus() echo " try nr_cpus=$nr_min or larger instead" }
-is_dump_to_rootfs() -{ - grep "^default[[:space:]]dump_to_rootfs" /etc/kdump.conf >/dev/null -} - # This function performs a series of edits on the command line. # Store the final result in global $KDUMP_COMMANDLINE. prepare_cmdline() diff --git a/mkdumprd b/mkdumprd index 45b185a..337ae87 100644 --- a/mkdumprd +++ b/mkdumprd @@ -278,18 +278,6 @@ handle_default_dump_target() check_size fs $_target }
-get_default_action_target() -{ - local _target - local _action=$(grep "^default" /etc/kdump.conf 2>/dev/null | awk '{print $2}') - if [ -n "$_action" ] && [ "$_action" = "dump_to_rootfs" ]; then - #get rootfs device name - _target=$(findmnt -k -f -n -o SOURCE /) - [ -b "$_target" ] && echo $(to_dev_name $_target) - fi - return -} - get_override_resettable() { local override_resettable
Resolves: bz1451717 https://bugzilla.redhat.com/1451717
Now that we have get_kdump_targets(), use it to simplify the code.
Signed-off-by: Xunlei Pang xlpang@redhat.com --- mkdumprd | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-)
diff --git a/mkdumprd b/mkdumprd index 337ae87..0fe1b30 100644 --- a/mkdumprd +++ b/mkdumprd @@ -295,22 +295,15 @@ get_override_resettable() # $1: function name for_each_block_target() { - local dev majmin + local index dev majmin
- #check dump target - dev=$(get_block_dump_target) - - if [ -n "$dev" ]; then - majmin=$(get_maj_min $dev) - check_block_and_slaves $1 $majmin && return 1 - fi - - #check rootfs when default action dump_to_rootfs is set - dev=$(get_default_action_target) - if [ -n "$dev" ]; then + index=0 + for dev in $(get_kdump_targets); do + index=$((index+1)) + [ -b "$dev" ] || continue majmin=$(get_maj_min $dev) - check_block_and_slaves $1 $majmin && return 2 - fi + check_block_and_slaves $1 $majmin && return $index + done
return 0 }
On 07/04/17 at 01:45pm, Xunlei Pang wrote:
Resolves: bz1451717 https://bugzilla.redhat.com/1451717
Now that we have get_kdump_targets(), use it to simplify the code.
Signed-off-by: Xunlei Pang xlpang@redhat.com
mkdumprd | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-)
diff --git a/mkdumprd b/mkdumprd index 337ae87..0fe1b30 100644 --- a/mkdumprd +++ b/mkdumprd @@ -295,22 +295,15 @@ get_override_resettable() # $1: function name for_each_block_target() {
- local dev majmin
- local index dev majmin
- #check dump target
- dev=$(get_block_dump_target)
- if [ -n "$dev" ]; then
majmin=$(get_maj_min $dev)
check_block_and_slaves $1 $majmin && return 1
- fi
- #check rootfs when default action dump_to_rootfs is set
- dev=$(get_default_action_target)
- if [ -n "$dev" ]; then
- index=0
seems here "index" is for the return value, originally 1 means dump target, 2 means dump_to_rootfs, but the index value is hiding this logic behind, if we later change get_kdump_targets, it is likely to be missed..
Maybe we can add the error message in check_resettable to is_resettable and only return same error value.
- for dev in $(get_kdump_targets); do
index=$((index+1))
[ -b "$dev" ] || continue majmin=$(get_maj_min $dev)
check_block_and_slaves $1 $majmin && return 2
- fi
check_block_and_slaves $1 $majmin && return $index
done
return 0
}
1.8.3.1 _______________________________________________ kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org
Thanks Dave
On 07/05/2017 at 11:30 AM, Dave Young wrote:
On 07/04/17 at 01:45pm, Xunlei Pang wrote:
Resolves: bz1451717 https://bugzilla.redhat.com/1451717
Now that we have get_kdump_targets(), use it to simplify the code.
Signed-off-by: Xunlei Pang xlpang@redhat.com
mkdumprd | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-)
diff --git a/mkdumprd b/mkdumprd index 337ae87..0fe1b30 100644 --- a/mkdumprd +++ b/mkdumprd @@ -295,22 +295,15 @@ get_override_resettable() # $1: function name for_each_block_target() {
- local dev majmin
- local index dev majmin
- #check dump target
- dev=$(get_block_dump_target)
- if [ -n "$dev" ]; then
majmin=$(get_maj_min $dev)
check_block_and_slaves $1 $majmin && return 1
- fi
- #check rootfs when default action dump_to_rootfs is set
- dev=$(get_default_action_target)
- if [ -n "$dev" ]; then
- index=0
seems here "index" is for the return value, originally 1 means dump target, 2 means dump_to_rootfs, but the index value is hiding this logic behind, if we later change get_kdump_targets, it is likely to be missed..
Maybe we can add the error message in check_resettable to is_resettable and only return same error value.
Yes, it stopped me too when I reached here, there are three messages: 1) check_resettable(): perror "Can not save vmcore to target device $_target . This device can not be initialized in kdump kernel as it is not resettable" 2) check_resettable(): perror "Rootfs device $_target is not resettable, can not be used as the default target, please specify a default action" 3) is_unresettable(): echo "Device $device is unresettable"
Which one do you think we can keep or drop in is_unresettable()? Or simply drop both 1) and 2) and keep 3) just like check_crypt() does?
Regards, Xunlei
- for dev in $(get_kdump_targets); do
index=$((index+1))
[ -b "$dev" ] || continue majmin=$(get_maj_min $dev)
check_block_and_slaves $1 $majmin && return 2
- fi
check_block_and_slaves $1 $majmin && return $index
done
return 0
}
1.8.3.1 _______________________________________________ kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org
Thanks Dave
On 07/05/17 at 04:36pm, Xunlei Pang wrote:
On 07/05/2017 at 11:30 AM, Dave Young wrote:
On 07/04/17 at 01:45pm, Xunlei Pang wrote:
Resolves: bz1451717 https://bugzilla.redhat.com/1451717
Now that we have get_kdump_targets(), use it to simplify the code.
Signed-off-by: Xunlei Pang xlpang@redhat.com
mkdumprd | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-)
diff --git a/mkdumprd b/mkdumprd index 337ae87..0fe1b30 100644 --- a/mkdumprd +++ b/mkdumprd @@ -295,22 +295,15 @@ get_override_resettable() # $1: function name for_each_block_target() {
- local dev majmin
- local index dev majmin
- #check dump target
- dev=$(get_block_dump_target)
- if [ -n "$dev" ]; then
majmin=$(get_maj_min $dev)
check_block_and_slaves $1 $majmin && return 1
- fi
- #check rootfs when default action dump_to_rootfs is set
- dev=$(get_default_action_target)
- if [ -n "$dev" ]; then
- index=0
seems here "index" is for the return value, originally 1 means dump target, 2 means dump_to_rootfs, but the index value is hiding this logic behind, if we later change get_kdump_targets, it is likely to be missed..
Maybe we can add the error message in check_resettable to is_resettable and only return same error value.
Yes, it stopped me too when I reached here, there are three messages:
- check_resettable(): perror "Can not save vmcore to target device $_target . This device can not be initialized in kdump kernel as it is not resettable"
- check_resettable(): perror "Rootfs device $_target is not resettable, can not be used as the default target, please specify a default action"
- is_unresettable(): echo "Device $device is unresettable"
Which one do you think we can keep or drop in is_unresettable()? Or simply drop both 1) and 2) and keep 3) just like check_crypt() does?
Drop 1) and 2) should be fine, we inherit these from old RHEL versions and maybe some old cards can not reset correctly, remove them make the code simpler.
If we can get the dump target in is_resettable it would be better we can print the target name as well. And print like: "Device $device is unresettable, can not save vmcore to $_target", but if can not it is also acceptable..
Regards, Xunlei
- for dev in $(get_kdump_targets); do
index=$((index+1))
[ -b "$dev" ] || continue majmin=$(get_maj_min $dev)
check_block_and_slaves $1 $majmin && return 2
- fi
check_block_and_slaves $1 $majmin && return $index
done
return 0
}
1.8.3.1 _______________________________________________ kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org
Thanks Dave
Thanks Dave
Resolves: bz1451717 https://bugzilla.redhat.com/1451717
When there is any "rd.lvm.lv=X", "lvm" dracut module will try to recognize all the lvm volumes which is unnecessary and probably cause trouble for us.
See https://bugzilla.redhat.com/show_bug.cgi?id=1451717#c2
Remove all the rd.lvm.lv=X inherited from the kernel cmdline, and generate the corresponding cmdline as needed.
Currently, we don't handle "rd.lvm.vg=X", we can add it in when there is some bug reported in the future.
Signed-off-by: Xunlei Pang xlpang@redhat.com --- kdumpctl | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+)
diff --git a/kdumpctl b/kdumpctl index 8c40564..fb4112e 100755 --- a/kdumpctl +++ b/kdumpctl @@ -171,6 +171,45 @@ check_kdump_cpus() echo " try nr_cpus=$nr_min or larger instead" }
+GENERATED_LVM_CMDLINES="" +# Generate rd.lvm.lv=X for the kdump targets if any. +generate_lvm_cmdline() +{ + local majmin=$1 dev + + [ -d "/sys/dev/block/$majmin/dm" ] || return 0 + dev=/dev/mapper/$(< "/sys/dev/block/$majmin/dm/name") + + vg=$(lvm lvs --rows $dev -o vg_name --separator=* 2>/dev/null | cut -d "*" -f 2) + lv=$(lvm lvs --rows $dev -o lv_name --separator=* 2>/dev/null | cut -d "*" -f 2) + if [ -n "$vg" -a -n "$lv" ]; then + GENERATED_LVM_CMDLINES="rd.lvm.lv=$vg/$lv $GENERATED_LVM_CMDLINES" + fi + + return 0 +} + +generate_lvm_cmdlines() +{ + for_each_block_target_all generate_lvm_cmdline + + echo "$GENERATED_LVM_CMDLINES" +} + +# $1: function name +for_each_block_target_all() +{ + local dev majmin + + for dev in $(get_kdump_targets); do + [ -b "$dev" ] || continue + majmin=$(get_maj_min $dev) + check_block_and_slaves_all $1 $majmin + done + + return 0 +} + # This function performs a series of edits on the command line. # Store the final result in global $KDUMP_COMMANDLINE. prepare_cmdline() @@ -199,6 +238,12 @@ prepare_cmdline() cmdline=`remove_cmdline_param "$cmdline" root` fi
+ # Remove all the inherited rd.lvm.lv=X and generate those as needed. + if [ $DEFAULT_DUMP_MODE != "fadump" ]; then + cmdline=`remove_cmdline_param "$cmdline" rd.lvm.lv` + cmdline="${cmdline} $(generate_lvm_cmdlines)" + fi + cmdline="${cmdline} ${KDUMP_COMMANDLINE_APPEND}"
id=`get_bootcpu_initial_apicid`
Resolves: bz1451717 https://bugzilla.redhat.com/1451717
When there is no crypt related kdump target, we can safely omit "crypt" dracut module, this can avoid the pop asking disk password during kdump boot in some cases.
Signed-off-by: Xunlei Pang xlpang@redhat.com --- kdump-lib.sh | 12 ++++++++++++ kdumpctl | 12 ------------ mkdumprd | 26 ++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 12 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 6b112a4..c09248d 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -6,6 +6,7 @@ DEFAULT_PATH="/var/crash/" FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump" FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send" +FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled"
perror_exit() { echo $@ >&2 @@ -485,3 +486,14 @@ get_dracut_args_target() { echo $1 | grep "--mount" | sed "s/.*--mount .(.*)/\1/" | cut -d' ' -f1 } + +is_fadump_capable() +{ + # Check if firmware-assisted dump is enabled + # if no, fallback to kdump check + if [ -f $FADUMP_ENABLED_SYS_NODE ]; then + rc=`cat $FADUMP_ENABLED_SYS_NODE` + [ $rc -eq 1 ] && return 0 + fi + return 1 +} diff --git a/kdumpctl b/kdumpctl index fb4112e..8c57f5f 100755 --- a/kdumpctl +++ b/kdumpctl @@ -13,7 +13,6 @@ DUMP_TARGET="" DEFAULT_INITRD="" DEFAULT_INITRD_BAK="" TARGET_INITRD="" -FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled" FADUMP_REGISTER_SYS_NODE="/sys/kernel/fadump_registered" #kdump shall be the default dump mode DEFAULT_DUMP_MODE="kdump" @@ -934,17 +933,6 @@ handle_mode_switch() fi }
-is_fadump_capable() -{ - # Check if firmware-assisted dump is enabled - # if no, fallback to kdump check - if [ -f $FADUMP_ENABLED_SYS_NODE ]; then - rc=`cat $FADUMP_ENABLED_SYS_NODE` - [ $rc -eq 1 ] && return 0 - fi - return 1 -} - check_current_fadump_status() { # Check if firmware-assisted dump has been registered. diff --git a/mkdumprd b/mkdumprd index 0fe1b30..0bd724c 100644 --- a/mkdumprd +++ b/mkdumprd @@ -382,6 +382,30 @@ check_crypt() return 1 }
+omit_dracut_modules() +{ + local target majmin + local has_crypt + + # Skip fadump case + is_fadump_capable && return + + has_crypt=0 + + for target in $(get_kdump_targets); do + if [ -b "$target" ]; then + # Check "crypt" + majmin=$(get_maj_min $target) + check_block_and_slaves is_crypt $majmin && has_crypt=1 + fi + done + + # Omit "crypt", BZ1451717 + if [ "$has_crypt" == "0" ]; then + add_dracut_arg "--omit" "crypt" + fi +} + if ! check_resettable; then exit 1 fi @@ -471,6 +495,8 @@ then add_dracut_arg "--add-drivers" "$extra_modules" fi
+omit_dracut_modules + dracut "${dracut_args[@]}" "$@" _rc=$? sync
Cc Hari for fadump part.
On 07/04/17 at 01:45pm, Xunlei Pang wrote:
Resolves: bz1451717 https://bugzilla.redhat.com/1451717
When there is no crypt related kdump target, we can safely omit "crypt" dracut module, this can avoid the pop asking disk password during kdump boot in some cases.
Signed-off-by: Xunlei Pang xlpang@redhat.com
kdump-lib.sh | 12 ++++++++++++ kdumpctl | 12 ------------ mkdumprd | 26 ++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 12 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 6b112a4..c09248d 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -6,6 +6,7 @@ DEFAULT_PATH="/var/crash/" FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump" FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send" +FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled"
perror_exit() { echo $@ >&2 @@ -485,3 +486,14 @@ get_dracut_args_target() { echo $1 | grep "--mount" | sed "s/.*--mount .(.*)/\1/" | cut -d' ' -f1 }
+is_fadump_capable() +{
- # Check if firmware-assisted dump is enabled
- # if no, fallback to kdump check
- if [ -f $FADUMP_ENABLED_SYS_NODE ]; then
rc=`cat $FADUMP_ENABLED_SYS_NODE`
[ $rc -eq 1 ] && return 0
- fi
- return 1
+} diff --git a/kdumpctl b/kdumpctl index fb4112e..8c57f5f 100755 --- a/kdumpctl +++ b/kdumpctl @@ -13,7 +13,6 @@ DUMP_TARGET="" DEFAULT_INITRD="" DEFAULT_INITRD_BAK="" TARGET_INITRD="" -FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled" FADUMP_REGISTER_SYS_NODE="/sys/kernel/fadump_registered" #kdump shall be the default dump mode DEFAULT_DUMP_MODE="kdump" @@ -934,17 +933,6 @@ handle_mode_switch() fi }
-is_fadump_capable() -{
- # Check if firmware-assisted dump is enabled
- # if no, fallback to kdump check
- if [ -f $FADUMP_ENABLED_SYS_NODE ]; then
rc=`cat $FADUMP_ENABLED_SYS_NODE`
[ $rc -eq 1 ] && return 0
- fi
- return 1
-}
check_current_fadump_status() { # Check if firmware-assisted dump has been registered. diff --git a/mkdumprd b/mkdumprd index 0fe1b30..0bd724c 100644 --- a/mkdumprd +++ b/mkdumprd @@ -382,6 +382,30 @@ check_crypt() return 1 }
+omit_dracut_modules() +{
- local target majmin
- local has_crypt
- # Skip fadump case
- is_fadump_capable && return
We have other default omitted modules in mkdumprd, seems fadump works well with it. Does that means we can omit below modules as well for fadump?
In fadump howto, it says there is some dracut changes to add kdump module to default initrd, but I do not find where is the dracut chagnes. I do not find anything in dracut repo..
- has_crypt=0
- for target in $(get_kdump_targets); do
if [ -b "$target" ]; then
# Check "crypt"
majmin=$(get_maj_min $target)
check_block_and_slaves is_crypt $majmin && has_crypt=1
fi
- done
- # Omit "crypt", BZ1451717
- if [ "$has_crypt" == "0" ]; then
add_dracut_arg "--omit" "crypt"
- fi
+}
if ! check_resettable; then exit 1 fi @@ -471,6 +495,8 @@ then add_dracut_arg "--add-drivers" "$extra_modules" fi
+omit_dracut_modules
dracut "${dracut_args[@]}" "$@" _rc=$? sync -- 1.8.3.1 _______________________________________________ kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org
Thanks Dave
Hi Dave,
Thanks for looping me in.
On Wednesday 05 July 2017 08:56 AM, Dave Young wrote:
Cc Hari for fadump part.
On 07/04/17 at 01:45pm, Xunlei Pang wrote:
Resolves: bz1451717 https://bugzilla.redhat.com/1451717
When there is no crypt related kdump target, we can safely omit "crypt" dracut module, this can avoid the pop asking disk password during kdump boot in some cases.
Signed-off-by: Xunlei Pang xlpang@redhat.com
kdump-lib.sh | 12 ++++++++++++ kdumpctl | 12 ------------ mkdumprd | 26 ++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 12 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 6b112a4..c09248d 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -6,6 +6,7 @@ DEFAULT_PATH="/var/crash/" FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump" FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send" +FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled"
perror_exit() { echo $@ >&2 @@ -485,3 +486,14 @@ get_dracut_args_target() { echo $1 | grep "--mount" | sed "s/.*--mount .(.*)/\1/" | cut -d' ' -f1 }
+is_fadump_capable() +{
- # Check if firmware-assisted dump is enabled
- # if no, fallback to kdump check
- if [ -f $FADUMP_ENABLED_SYS_NODE ]; then
rc=`cat $FADUMP_ENABLED_SYS_NODE`
[ $rc -eq 1 ] && return 0
- fi
- return 1
+} diff --git a/kdumpctl b/kdumpctl index fb4112e..8c57f5f 100755 --- a/kdumpctl +++ b/kdumpctl @@ -13,7 +13,6 @@ DUMP_TARGET="" DEFAULT_INITRD="" DEFAULT_INITRD_BAK="" TARGET_INITRD="" -FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled" FADUMP_REGISTER_SYS_NODE="/sys/kernel/fadump_registered" #kdump shall be the default dump mode DEFAULT_DUMP_MODE="kdump" @@ -934,17 +933,6 @@ handle_mode_switch() fi }
-is_fadump_capable() -{
- # Check if firmware-assisted dump is enabled
- # if no, fallback to kdump check
- if [ -f $FADUMP_ENABLED_SYS_NODE ]; then
rc=`cat $FADUMP_ENABLED_SYS_NODE`
[ $rc -eq 1 ] && return 0
- fi
- return 1
-}
- check_current_fadump_status() { # Check if firmware-assisted dump has been registered.
diff --git a/mkdumprd b/mkdumprd index 0fe1b30..0bd724c 100644 --- a/mkdumprd +++ b/mkdumprd @@ -382,6 +382,30 @@ check_crypt() return 1 }
+omit_dracut_modules() +{
- local target majmin
- local has_crypt
- # Skip fadump case
- is_fadump_capable && return
We have other default omitted modules in mkdumprd, seems fadump works well with it. Does that means we can omit below modules as well for fadump?
Since fadump initrd is the same as default initrd, I think the patch is doing the right thing by skipping omission of crypt module in fadump mode.
In fadump howto, it says there is some dracut changes to add kdump module to default initrd, but I do not find where is the dracut chagnes. I do not find anything in dracut repo..
dracut-module-setup.sh & mkdumprd files in kexec-tools repo have the relevant change. When IN_KDUMP is set to '1', kdump module is inserted out-of-tree into initrd. With mkdumprd script exporting "IN_KDUMP=1" environment variable and kdumpctl script calling mkdumprd to make the initrd, kdump module is included in kdump initrd in kdump mode and default initrd in fadump mode.
Thanks Hari
On 07/05/2017 at 08:59 PM, Hari Bathini wrote:
Hi Dave,
Thanks for looping me in.
On Wednesday 05 July 2017 08:56 AM, Dave Young wrote:
Cc Hari for fadump part.
On 07/04/17 at 01:45pm, Xunlei Pang wrote:
Resolves: bz1451717 https://bugzilla.redhat.com/1451717
When there is no crypt related kdump target, we can safely omit "crypt" dracut module, this can avoid the pop asking disk password during kdump boot in some cases.
Signed-off-by: Xunlei Pang xlpang@redhat.com
kdump-lib.sh | 12 ++++++++++++ kdumpctl | 12 ------------ mkdumprd | 26 ++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 12 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 6b112a4..c09248d 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -6,6 +6,7 @@ DEFAULT_PATH="/var/crash/" FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump" FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send" +FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled" perror_exit() { echo $@ >&2 @@ -485,3 +486,14 @@ get_dracut_args_target() { echo $1 | grep "--mount" | sed "s/.*--mount .(.*)/\1/" | cut -d' ' -f1 }
+is_fadump_capable() +{
- # Check if firmware-assisted dump is enabled
- # if no, fallback to kdump check
- if [ -f $FADUMP_ENABLED_SYS_NODE ]; then
rc=`cat $FADUMP_ENABLED_SYS_NODE`
[ $rc -eq 1 ] && return 0
- fi
- return 1
+} diff --git a/kdumpctl b/kdumpctl index fb4112e..8c57f5f 100755 --- a/kdumpctl +++ b/kdumpctl @@ -13,7 +13,6 @@ DUMP_TARGET="" DEFAULT_INITRD="" DEFAULT_INITRD_BAK="" TARGET_INITRD="" -FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled" FADUMP_REGISTER_SYS_NODE="/sys/kernel/fadump_registered" #kdump shall be the default dump mode DEFAULT_DUMP_MODE="kdump" @@ -934,17 +933,6 @@ handle_mode_switch() fi } -is_fadump_capable() -{
- # Check if firmware-assisted dump is enabled
- # if no, fallback to kdump check
- if [ -f $FADUMP_ENABLED_SYS_NODE ]; then
rc=`cat $FADUMP_ENABLED_SYS_NODE`
[ $rc -eq 1 ] && return 0
- fi
- return 1
-}
- check_current_fadump_status() { # Check if firmware-assisted dump has been registered.
diff --git a/mkdumprd b/mkdumprd index 0fe1b30..0bd724c 100644 --- a/mkdumprd +++ b/mkdumprd @@ -382,6 +382,30 @@ check_crypt() return 1 } +omit_dracut_modules() +{
- local target majmin
- local has_crypt
- # Skip fadump case
- is_fadump_capable && return
We have other default omitted modules in mkdumprd, seems fadump works well with it. Does that means we can omit below modules as well for fadump?
Since fadump initrd is the same as default initrd, I think the patch is doing the
Hi Hari,
Thanks for the comments.
I did some code review, and found that the fadump initramfs generated by kexec-tools is not the same as default initrd, for example, kdump uses the following dracut cmd to generate(with --rebuild) initramfs: dracut --hostonly --hostonly-cmdline --hostonly-i18n -o plymouth dash resume ifcfg -f /boot/initramfs-3.10.0-691.el7.ppc64le.img.tmp --rebuild /boot/initramfs-3.10.0-691.el7.ppc64le.img --kver 3.10.0-691.el7.ppc64le -i /tmp/fadump.initramfs /etc/fadump.initramfs
1) original initramfs Image: .initramfs-3.10.0-691.el7.ppc64le.img.default: 21M ======================================================================== Version: dracut-033-502.el7
Arguments: -f
dracut modules: bash nss-softokn i18n network ifcfg drm plymouth dm kernel-modules lvm resume rootfs-block terminfo udev-rules systemd usrmount base fs-lib shutdown
2) kdump initramfs used by fadump Image: initramfs-3.10.0-691.el7.ppc64le.img: 19M ======================================================================== Version: dracut-033-502.el7
Arguments: -f --hostonly --hostonly-cmdline --hostonly-i18n -o 'plymouth dash resume ifcfg' -f --kver '3.10.0-691.el7.ppc64le' --include '/tmp/fadump.initramfs' '/etc/fadump.initramfs'
dracut modules: bash nss-softokn i18n network dm kernel-modules lvm rootfs-block terminfo udev-rules systemd usrmount base fs-lib kdumpbase shutdown
Do you think there is a problem that the two are a little different(especially with the extra "--hostonly" and -o 'plymouth dash resume ifcfg')?
Regards, Xunlei
right thing by skipping omission of crypt module in fadump mode.
In fadump howto, it says there is some dracut changes to add kdump module to default initrd, but I do not find where is the dracut chagnes. I do not find anything in dracut repo..
dracut-module-setup.sh & mkdumprd files in kexec-tools repo have the relevant change. When IN_KDUMP is set to '1', kdump module is inserted out-of-tree into initrd. With mkdumprd script exporting "IN_KDUMP=1" environment variable and kdumpctl script calling mkdumprd to make the initrd, kdump module is included in kdump initrd in kdump mode and default initrd in fadump mode.
Thanks Hari
Hi Xunlei,
On Thursday 06 July 2017 10:38 AM, Xunlei Pang wrote:
On 07/05/2017 at 08:59 PM, Hari Bathini wrote:
Hi Dave,
Thanks for looping me in.
On Wednesday 05 July 2017 08:56 AM, Dave Young wrote:
Cc Hari for fadump part.
On 07/04/17 at 01:45pm, Xunlei Pang wrote:
Resolves: bz1451717 https://bugzilla.redhat.com/1451717
When there is no crypt related kdump target, we can safely omit "crypt" dracut module, this can avoid the pop asking disk password during kdump boot in some cases.
Signed-off-by: Xunlei Pang xlpang@redhat.com
kdump-lib.sh | 12 ++++++++++++ kdumpctl | 12 ------------ mkdumprd | 26 ++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 12 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 6b112a4..c09248d 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -6,6 +6,7 @@ DEFAULT_PATH="/var/crash/" FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump" FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send" +FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled" perror_exit() { echo $@ >&2 @@ -485,3 +486,14 @@ get_dracut_args_target() { echo $1 | grep "--mount" | sed "s/.*--mount .(.*)/\1/" | cut -d' ' -f1 }
+is_fadump_capable() +{
- # Check if firmware-assisted dump is enabled
- # if no, fallback to kdump check
- if [ -f $FADUMP_ENABLED_SYS_NODE ]; then
rc=`cat $FADUMP_ENABLED_SYS_NODE`
[ $rc -eq 1 ] && return 0
- fi
- return 1
+} diff --git a/kdumpctl b/kdumpctl index fb4112e..8c57f5f 100755 --- a/kdumpctl +++ b/kdumpctl @@ -13,7 +13,6 @@ DUMP_TARGET="" DEFAULT_INITRD="" DEFAULT_INITRD_BAK="" TARGET_INITRD="" -FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled" FADUMP_REGISTER_SYS_NODE="/sys/kernel/fadump_registered" #kdump shall be the default dump mode DEFAULT_DUMP_MODE="kdump" @@ -934,17 +933,6 @@ handle_mode_switch() fi } -is_fadump_capable() -{
- # Check if firmware-assisted dump is enabled
- # if no, fallback to kdump check
- if [ -f $FADUMP_ENABLED_SYS_NODE ]; then
rc=`cat $FADUMP_ENABLED_SYS_NODE`
[ $rc -eq 1 ] && return 0
- fi
- return 1
-}
- check_current_fadump_status() { # Check if firmware-assisted dump has been registered.
diff --git a/mkdumprd b/mkdumprd index 0fe1b30..0bd724c 100644 --- a/mkdumprd +++ b/mkdumprd @@ -382,6 +382,30 @@ check_crypt() return 1 } +omit_dracut_modules() +{
- local target majmin
- local has_crypt
- # Skip fadump case
- is_fadump_capable && return
We have other default omitted modules in mkdumprd, seems fadump works well with it. Does that means we can omit below modules as well for fadump?
Since fadump initrd is the same as default initrd, I think the patch is doing the
Hi Hari,
Thanks for the comments.
I did some code review, and found that the fadump initramfs generated by kexec-tools is not the same as default initrd, for example, kdump uses the following dracut cmd
By same, I meant the same initrd is used for fadump dump capture and booting production kernel.
to generate(with --rebuild) initramfs: dracut --hostonly --hostonly-cmdline --hostonly-i18n -o plymouth dash resume ifcfg -f /boot/initramfs-3.10.0-691.el7.ppc64le.img.tmp --rebuild /boot/initramfs-3.10.0-691.el7.ppc64le.img --kver 3.10.0-691.el7.ppc64le -i /tmp/fadump.initramfs /etc/fadump.initramfs
- original initramfs
Image: .initramfs-3.10.0-691.el7.ppc64le.img.default: 21M
Version: dracut-033-502.el7
Arguments: -f
dracut modules: bash nss-softokn i18n network ifcfg drm plymouth dm kernel-modules lvm resume rootfs-block terminfo udev-rules systemd usrmount base fs-lib shutdown
- kdump initramfs used by fadump
Image: initramfs-3.10.0-691.el7.ppc64le.img: 19M
Version: dracut-033-502.el7
Arguments: -f --hostonly --hostonly-cmdline --hostonly-i18n -o 'plymouth dash resume ifcfg' -f --kver '3.10.0-691.el7.ppc64le' --include '/tmp/fadump.initramfs' '/etc/fadump.initramfs'
dracut modules: bash nss-softokn i18n network dm kernel-modules lvm rootfs-block terminfo udev-rules systemd usrmount base fs-lib kdumpbase shutdown
Do you think there is a problem that the two are a little different(especially with the extra "--hostonly" and -o 'plymouth dash resume ifcfg')?
I agree that there are a few differences. '--rebuild' option in dracut was introduced to ensure the existing initrd is taken as input and the changes on top of that are only those that are explicitly specified. IIRC, these options have been there since fadump was first introduced and I have not seen any issues using the initrd to boot the production kernel, at least so far..
Thanks Hari
On 07/06/2017 at 01:41 PM, Hari Bathini wrote:
Hi Xunlei,
On Thursday 06 July 2017 10:38 AM, Xunlei Pang wrote:
On 07/05/2017 at 08:59 PM, Hari Bathini wrote:
Hi Dave,
Thanks for looping me in.
On Wednesday 05 July 2017 08:56 AM, Dave Young wrote:
Cc Hari for fadump part.
On 07/04/17 at 01:45pm, Xunlei Pang wrote:
Resolves: bz1451717 https://bugzilla.redhat.com/1451717
When there is no crypt related kdump target, we can safely omit "crypt" dracut module, this can avoid the pop asking disk password during kdump boot in some cases.
Signed-off-by: Xunlei Pang xlpang@redhat.com
kdump-lib.sh | 12 ++++++++++++ kdumpctl | 12 ------------ mkdumprd | 26 ++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 12 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 6b112a4..c09248d 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -6,6 +6,7 @@ DEFAULT_PATH="/var/crash/" FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump" FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send" +FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled" perror_exit() { echo $@ >&2 @@ -485,3 +486,14 @@ get_dracut_args_target() { echo $1 | grep "--mount" | sed "s/.*--mount .(.*)/\1/" | cut -d' ' -f1 }
+is_fadump_capable() +{
- # Check if firmware-assisted dump is enabled
- # if no, fallback to kdump check
- if [ -f $FADUMP_ENABLED_SYS_NODE ]; then
rc=`cat $FADUMP_ENABLED_SYS_NODE`
[ $rc -eq 1 ] && return 0
- fi
- return 1
+} diff --git a/kdumpctl b/kdumpctl index fb4112e..8c57f5f 100755 --- a/kdumpctl +++ b/kdumpctl @@ -13,7 +13,6 @@ DUMP_TARGET="" DEFAULT_INITRD="" DEFAULT_INITRD_BAK="" TARGET_INITRD="" -FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled" FADUMP_REGISTER_SYS_NODE="/sys/kernel/fadump_registered" #kdump shall be the default dump mode DEFAULT_DUMP_MODE="kdump" @@ -934,17 +933,6 @@ handle_mode_switch() fi } -is_fadump_capable() -{
- # Check if firmware-assisted dump is enabled
- # if no, fallback to kdump check
- if [ -f $FADUMP_ENABLED_SYS_NODE ]; then
rc=`cat $FADUMP_ENABLED_SYS_NODE`
[ $rc -eq 1 ] && return 0
- fi
- return 1
-}
- check_current_fadump_status() { # Check if firmware-assisted dump has been registered.
diff --git a/mkdumprd b/mkdumprd index 0fe1b30..0bd724c 100644 --- a/mkdumprd +++ b/mkdumprd @@ -382,6 +382,30 @@ check_crypt() return 1 } +omit_dracut_modules() +{
- local target majmin
- local has_crypt
- # Skip fadump case
- is_fadump_capable && return
We have other default omitted modules in mkdumprd, seems fadump works well with it. Does that means we can omit below modules as well for fadump?
Since fadump initrd is the same as default initrd, I think the patch is doing the
Hi Hari,
Thanks for the comments.
I did some code review, and found that the fadump initramfs generated by kexec-tools is not the same as default initrd, for example, kdump uses the following dracut cmd
By same, I meant the same initrd is used for fadump dump capture and booting production kernel.
to generate(with --rebuild) initramfs: dracut --hostonly --hostonly-cmdline --hostonly-i18n -o plymouth dash resume ifcfg -f /boot/initramfs-3.10.0-691.el7.ppc64le.img.tmp --rebuild /boot/initramfs-3.10.0-691.el7.ppc64le.img --kver 3.10.0-691.el7.ppc64le -i /tmp/fadump.initramfs /etc/fadump.initramfs
- original initramfs
Image: .initramfs-3.10.0-691.el7.ppc64le.img.default: 21M
Version: dracut-033-502.el7
Arguments: -f
dracut modules: bash nss-softokn i18n network ifcfg drm plymouth dm kernel-modules lvm resume rootfs-block terminfo udev-rules systemd usrmount base fs-lib shutdown
- kdump initramfs used by fadump
Image: initramfs-3.10.0-691.el7.ppc64le.img: 19M
Version: dracut-033-502.el7
Arguments: -f --hostonly --hostonly-cmdline --hostonly-i18n -o 'plymouth dash resume ifcfg' -f --kver '3.10.0-691.el7.ppc64le' --include '/tmp/fadump.initramfs' '/etc/fadump.initramfs'
dracut modules: bash nss-softokn i18n network dm kernel-modules lvm rootfs-block terminfo udev-rules systemd usrmount base fs-lib kdumpbase shutdown
Do you think there is a problem that the two are a little different(especially with the extra "--hostonly" and -o 'plymouth dash resume ifcfg')?
I agree that there are a few differences. '--rebuild' option in dracut was introduced to ensure the existing initrd is taken as input and the changes on top of that are only those that are explicitly specified. IIRC, these options have been there since fadump was first introduced and I have not seen any issues using the initrd to boot the production kernel, at least so far..
OK, agree, let's leave it as it was :-)
Regards, Xunlei
In case of on lvm related target, we can clearly and safely remove many unnecessary modules to reduce initramfs size, and to enhance stability.
Signed-off-by: Xunlei Pang xlpang@redhat.com --- mkdumprd | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/mkdumprd b/mkdumprd index 0bd724c..ad44325 100644 --- a/mkdumprd +++ b/mkdumprd @@ -382,21 +382,34 @@ check_crypt() return 1 }
+is_lvm() +{ + if [ -d "/sys/dev/block/$1/dm" ]; then + return 0 + fi + + return 1 +} + omit_dracut_modules() { local target majmin - local has_crypt + local has_crypt has_lvm
# Skip fadump case is_fadump_capable && return
has_crypt=0 + has_lvm=0
for target in $(get_kdump_targets); do if [ -b "$target" ]; then # Check "crypt" majmin=$(get_maj_min $target) check_block_and_slaves is_crypt $majmin && has_crypt=1 + + # Check "lvm" + check_block_and_slaves is_lvm $majmin && has_lvm=1 fi done
@@ -404,6 +417,12 @@ omit_dracut_modules() if [ "$has_crypt" == "0" ]; then add_dracut_arg "--omit" "crypt" fi + + # Further omit more modules in case of no lvm related target + if [ "$has_lvm" == "0" ]; then + # "has_lvm=0" implies "has_crypt=0" + add_dracut_arg "--omit" "lvm dm multipath dmraid" + fi }
if ! check_resettable; then
On 07/04/17 at 01:45pm, Xunlei Pang wrote:
In case of on lvm related target, we can clearly and safely remove many unnecessary modules to reduce initramfs size, and to enhance stability.
Signed-off-by: Xunlei Pang xlpang@redhat.com
mkdumprd | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/mkdumprd b/mkdumprd index 0bd724c..ad44325 100644 --- a/mkdumprd +++ b/mkdumprd @@ -382,21 +382,34 @@ check_crypt() return 1 }
+is_lvm() +{
- if [ -d "/sys/dev/block/$1/dm" ]; then
return 0
- fi
- return 1
+}
omit_dracut_modules() { local target majmin
- local has_crypt
local has_crypt has_lvm
# Skip fadump case is_fadump_capable && return
has_crypt=0
has_lvm=0
for target in $(get_kdump_targets); do if [ -b "$target" ]; then # Check "crypt" majmin=$(get_maj_min $target) check_block_and_slaves is_crypt $majmin && has_crypt=1
# Check "lvm"
check_block_and_slaves is_lvm $majmin && has_lvm=1 fi
done
@@ -404,6 +417,12 @@ omit_dracut_modules() if [ "$has_crypt" == "0" ]; then add_dracut_arg "--omit" "crypt" fi
- # Further omit more modules in case of no lvm related target
- if [ "$has_lvm" == "0" ]; then
Since it is not only lvm, how about change the name to has_dm and is_dm?
# "has_lvm=0" implies "has_crypt=0"
add_dracut_arg "--omit" "lvm dm multipath dmraid"
- fi
}
if ! check_resettable; then
1.8.3.1 _______________________________________________ kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org
Thanks Dave
On 07/05/2017 at 11:32 AM, Dave Young wrote:
On 07/04/17 at 01:45pm, Xunlei Pang wrote:
In case of on lvm related target, we can clearly and safely remove many unnecessary modules to reduce initramfs size, and to enhance stability.
Signed-off-by: Xunlei Pang xlpang@redhat.com
mkdumprd | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/mkdumprd b/mkdumprd index 0bd724c..ad44325 100644 --- a/mkdumprd +++ b/mkdumprd @@ -382,21 +382,34 @@ check_crypt() return 1 }
+is_lvm() +{
- if [ -d "/sys/dev/block/$1/dm" ]; then
return 0
- fi
- return 1
+}
omit_dracut_modules() { local target majmin
- local has_crypt
local has_crypt has_lvm
# Skip fadump case is_fadump_capable && return
has_crypt=0
has_lvm=0
for target in $(get_kdump_targets); do if [ -b "$target" ]; then # Check "crypt" majmin=$(get_maj_min $target) check_block_and_slaves is_crypt $majmin && has_crypt=1
# Check "lvm"
check_block_and_slaves is_lvm $majmin && has_lvm=1 fi
done
@@ -404,6 +417,12 @@ omit_dracut_modules() if [ "$has_crypt" == "0" ]; then add_dracut_arg "--omit" "crypt" fi
- # Further omit more modules in case of no lvm related target
- if [ "$has_lvm" == "0" ]; then
Since it is not only lvm, how about change the name to has_dm and is_dm?
"has_dm" sounds better, will use this one. Thanks!
# "has_lvm=0" implies "has_crypt=0"
add_dracut_arg "--omit" "lvm dm multipath dmraid"
- fi
}
if ! check_resettable; then
1.8.3.1 _______________________________________________ kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org
Thanks Dave
In case of only nfs/ssh target, we can clearly and safely remove more unnecessary modules to reduce initramfs size, and to enhance stability.
Signed-off-by: Xunlei Pang xlpang@redhat.com --- mkdumprd | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/mkdumprd b/mkdumprd index ad44325..8bb883a 100644 --- a/mkdumprd +++ b/mkdumprd @@ -394,13 +394,14 @@ is_lvm() omit_dracut_modules() { local target majmin - local has_crypt has_lvm + local has_crypt has_lvm all_nfs_ssh
# Skip fadump case is_fadump_capable && return
has_crypt=0 has_lvm=0 + all_nfs_ssh=1
for target in $(get_kdump_targets); do if [ -b "$target" ]; then @@ -411,6 +412,9 @@ omit_dracut_modules() # Check "lvm" check_block_and_slaves is_lvm $majmin && has_lvm=1 fi + + # Check nfs/ssh dumping + [[ "$target" != "nfs" && "$target" != "ssh" ]] && all_nfs_ssh=0 done
# Omit "crypt", BZ1451717 @@ -423,6 +427,12 @@ omit_dracut_modules() # "has_lvm=0" implies "has_crypt=0" add_dracut_arg "--omit" "lvm dm multipath dmraid" fi + + # Further omit more modules in case of nfs/ssh dumping + if [ "$all_nfs_ssh" == "1" ]; then + # "all_nfs_ssh=1" implies "has_lvm=0" + add_dracut_arg "--omit" "iscsi fcoe fcoe-uefi" + fi }
if ! check_resettable; then
On 07/04/17 at 01:45pm, Xunlei Pang wrote:
In case of only nfs/ssh target, we can clearly and safely remove more unnecessary modules to reduce initramfs size, and to enhance stability.
Signed-off-by: Xunlei Pang xlpang@redhat.com
mkdumprd | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/mkdumprd b/mkdumprd index ad44325..8bb883a 100644 --- a/mkdumprd +++ b/mkdumprd @@ -394,13 +394,14 @@ is_lvm() omit_dracut_modules() { local target majmin
- local has_crypt has_lvm
local has_crypt has_lvm all_nfs_ssh
# Skip fadump case is_fadump_capable && return
has_crypt=0 has_lvm=0
all_nfs_ssh=1
for target in $(get_kdump_targets); do if [ -b "$target" ]; then
@@ -411,6 +412,9 @@ omit_dracut_modules() # Check "lvm" check_block_and_slaves is_lvm $majmin && has_lvm=1 fi
# Check nfs/ssh dumping
[[ "$target" != "nfs" && "$target" != "ssh" ]] && all_nfs_ssh=0
how about change the all_nfs_ssh to has_only_network?
done # Omit "crypt", BZ1451717
@@ -423,6 +427,12 @@ omit_dracut_modules() # "has_lvm=0" implies "has_crypt=0" add_dracut_arg "--omit" "lvm dm multipath dmraid" fi
- # Further omit more modules in case of nfs/ssh dumping
- if [ "$all_nfs_ssh" == "1" ]; then
# "all_nfs_ssh=1" implies "has_lvm=0"
add_dracut_arg "--omit" "iscsi fcoe fcoe-uefi"
- fi
}
if ! check_resettable; then
1.8.3.1 _______________________________________________ kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org
On 07/05/2017 at 11:39 AM, Dave Young wrote:
On 07/04/17 at 01:45pm, Xunlei Pang wrote:
In case of only nfs/ssh target, we can clearly and safely remove more unnecessary modules to reduce initramfs size, and to enhance stability.
Signed-off-by: Xunlei Pang xlpang@redhat.com
mkdumprd | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/mkdumprd b/mkdumprd index ad44325..8bb883a 100644 --- a/mkdumprd +++ b/mkdumprd @@ -394,13 +394,14 @@ is_lvm() omit_dracut_modules() { local target majmin
- local has_crypt has_lvm
local has_crypt has_lvm all_nfs_ssh
# Skip fadump case is_fadump_capable && return
has_crypt=0 has_lvm=0
all_nfs_ssh=1
for target in $(get_kdump_targets); do if [ -b "$target" ]; then
@@ -411,6 +412,9 @@ omit_dracut_modules() # Check "lvm" check_block_and_slaves is_lvm $majmin && has_lvm=1 fi
# Check nfs/ssh dumping
[[ "$target" != "nfs" && "$target" != "ssh" ]] && all_nfs_ssh=0
how about change the all_nfs_ssh to has_only_network?
Ok, I am fine with "has_only_network".
Regards, Xunlei
done # Omit "crypt", BZ1451717
@@ -423,6 +427,12 @@ omit_dracut_modules() # "has_lvm=0" implies "has_crypt=0" add_dracut_arg "--omit" "lvm dm multipath dmraid" fi
- # Further omit more modules in case of nfs/ssh dumping
- if [ "$all_nfs_ssh" == "1" ]; then
# "all_nfs_ssh=1" implies "has_lvm=0"
add_dracut_arg "--omit" "iscsi fcoe fcoe-uefi"
- fi
}
if ! check_resettable; then
1.8.3.1 _______________________________________________ kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org
On 07/04/17 at 01:45pm, Xunlei Pang wrote:
In case of only nfs/ssh target, we can clearly and safely remove more unnecessary modules to reduce initramfs size, and to enhance stability.
Signed-off-by: Xunlei Pang xlpang@redhat.com
mkdumprd | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/mkdumprd b/mkdumprd index ad44325..8bb883a 100644 --- a/mkdumprd +++ b/mkdumprd @@ -394,13 +394,14 @@ is_lvm() omit_dracut_modules() { local target majmin
- local has_crypt has_lvm
- local has_crypt has_lvm all_nfs_ssh
Just pass by and saw your discussion about the name of all_nfs_ssh.
In fact, here I suppose you are trying to define a variable of bool type. It should be like 'is_crypt_existed or crypt_detected' things. We can't define a variable naming as a verb plus a noun, this is more like a function naming. Just my personal opinion.
# Skip fadump case is_fadump_capable && return has_crypt=0 has_lvm=0
all_nfs_ssh=1
for target in $(get_kdump_targets); do if [ -b "$target" ]; then
@@ -411,6 +412,9 @@ omit_dracut_modules() # Check "lvm" check_block_and_slaves is_lvm $majmin && has_lvm=1 fi
# Check nfs/ssh dumping
[[ "$target" != "nfs" && "$target" != "ssh" ]] && all_nfs_ssh=0
done
# Omit "crypt", BZ1451717
@@ -423,6 +427,12 @@ omit_dracut_modules() # "has_lvm=0" implies "has_crypt=0" add_dracut_arg "--omit" "lvm dm multipath dmraid" fi
- # Further omit more modules in case of nfs/ssh dumping
- if [ "$all_nfs_ssh" == "1" ]; then
# "all_nfs_ssh=1" implies "has_lvm=0"
add_dracut_arg "--omit" "iscsi fcoe fcoe-uefi"
- fi
}
if ! check_resettable; then
1.8.3.1 _______________________________________________ kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org
On 07/05/2017 at 05:04 PM, Baoquan He wrote:
On 07/04/17 at 01:45pm, Xunlei Pang wrote:
In case of only nfs/ssh target, we can clearly and safely remove more unnecessary modules to reduce initramfs size, and to enhance stability.
Signed-off-by: Xunlei Pang xlpang@redhat.com
mkdumprd | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/mkdumprd b/mkdumprd index ad44325..8bb883a 100644 --- a/mkdumprd +++ b/mkdumprd @@ -394,13 +394,14 @@ is_lvm() omit_dracut_modules() { local target majmin
- local has_crypt has_lvm
- local has_crypt has_lvm all_nfs_ssh
Just pass by and saw your discussion about the name of all_nfs_ssh.
In fact, here I suppose you are trying to define a variable of bool type. It should be like 'is_crypt_existed or crypt_detected' things. We can't define a variable naming as a verb plus a noun, this is more like a function naming. Just my personal opinion.
OK, I am gonna use crypt_exists/dm_exists/network_only instead.
Regards, Xunlei
# Skip fadump case is_fadump_capable && return has_crypt=0 has_lvm=0
all_nfs_ssh=1
for target in $(get_kdump_targets); do if [ -b "$target" ]; then
@@ -411,6 +412,9 @@ omit_dracut_modules() # Check "lvm" check_block_and_slaves is_lvm $majmin && has_lvm=1 fi
# Check nfs/ssh dumping
[[ "$target" != "nfs" && "$target" != "ssh" ]] && all_nfs_ssh=0
done
# Omit "crypt", BZ1451717
@@ -423,6 +427,12 @@ omit_dracut_modules() # "has_lvm=0" implies "has_crypt=0" add_dracut_arg "--omit" "lvm dm multipath dmraid" fi
- # Further omit more modules in case of nfs/ssh dumping
- if [ "$all_nfs_ssh" == "1" ]; then
# "all_nfs_ssh=1" implies "has_lvm=0"
add_dracut_arg "--omit" "iscsi fcoe fcoe-uefi"
- fi
}
if ! check_resettable; then
1.8.3.1 _______________________________________________ kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org