This patch series 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.
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 (4): kdump-lib.sh: fix inproper get_block_dump_target() kdumpctl: collect all the kdump targets kdumpctl: use generated rd.lvm.lv=X mkdumprd: omit crypt when there is no crypt kdump target
kdump-lib.sh | 44 ++++++++++++++++++++----- kdumpctl | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++++------ mkdumprd | 39 ++++++++++++++-------- 3 files changed, 158 insertions(+), 31 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..ae54b7f 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 + + _target=$(get_user_configured_dump_disk) + [ -n "$_target" ] && echo $(to_dev_name $_target) && return + + if is_ssh_dump_target || is_nfs_dump_target; then + return + fi + + # 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 06/30/17 at 11:18am, 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..ae54b7f 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
- _target=$(get_user_configured_dump_disk)
- [ -n "$_target" ] && echo $(to_dev_name $_target) && return
- if is_ssh_dump_target || is_nfs_dump_target; then
return
- fi
Move ssh/nfs checking to the beginning should be better.
Otherwise the patch looks good.
- # 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/03/2017 at 01:21 PM, Dave Young wrote:
Hi Xunlei, On 06/30/17 at 11:18am, 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..ae54b7f 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
- _target=$(get_user_configured_dump_disk)
- [ -n "$_target" ] && echo $(to_dev_name $_target) && return
- if is_ssh_dump_target || is_nfs_dump_target; then
return
- fi
Move ssh/nfs checking to the beginning should be better.
Otherwise the patch looks good.
OK, will do, thanks!
We need to know all the kdump targets(not only dump target), 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 --- kdumpctl | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+)
diff --git a/kdumpctl b/kdumpctl index 0e53793..221b461 100755 --- a/kdumpctl +++ b/kdumpctl @@ -452,6 +452,60 @@ setup_initrd() fi }
+collect_kdump_target() +{ + local _dev=$1 + + if [ -b "$_dev" ]; then + _dev=$(get_persistent_dev $_dev) + fi + + # Use export to let mkdumprd(etc) also know it. + if [ -n "$KDUMP_TARGETS" ]; then + export KDUMP_TARGETS="$KDUMP_TARGETS $_dev" + else + export KDUMP_TARGETS="$_dev" + fi +} + +# Collect targets(not only dump target) that will be recognized under kdump. +collect_kdump_targets() +{ + local _target _root + + # Do not care about fadump + if [ $DEFAULT_DUMP_MODE == "fadump" ]; then + return + fi + + _target=$(get_block_dump_target) + if [ -n "$_target" ]; then + collect_kdump_target $_target + elif is_ssh_dump_target; then + collect_kdump_target "ssh" + else + collect_kdump_target "nfs" + fi + + # Add the root device if dump_to_rootfs is specified. + ! is_dump_to_rootfs && return + _root=$(get_root_fs_device) + [[ "$_root" = "$_target" ]] && return + if [[ -b "$_root" ]]; then + collect_kdump_target $_root + else + collect_kdump_target "nfs" + 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. +} + check_files_modified() { local modified_files="" @@ -693,6 +747,8 @@ check_rebuild() return 1 fi
+ collect_kdump_targets + # Will not rebuild kdump initrd if [ "$force_no_rebuild" == "1" ]; then return 0
Hi Xunlei, On 06/30/17 at 11:18am, Xunlei Pang wrote:
We need to know all the kdump targets(not only dump target), this is useful for us to do some extra work related to the type of different targets.
It is not clear what is "all the kdump targets", can you add more words in patchlog?
Looks like it includes dump target and dump_to_rootfs from the code. It is better to add the purpose as well why we need this..
Signed-off-by: Xunlei Pang xlpang@redhat.com
kdumpctl | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+)
diff --git a/kdumpctl b/kdumpctl index 0e53793..221b461 100755 --- a/kdumpctl +++ b/kdumpctl @@ -452,6 +452,60 @@ setup_initrd() fi }
+collect_kdump_target() +{
- local _dev=$1
- if [ -b "$_dev" ]; then
_dev=$(get_persistent_dev $_dev)
- fi
- # Use export to let mkdumprd(etc) also know it.
- if [ -n "$KDUMP_TARGETS" ]; then
export KDUMP_TARGETS="$KDUMP_TARGETS $_dev"
- else
export KDUMP_TARGETS="$_dev"
Assume this is for export shared variable for mkdumprd.
Originally in the initial phase of Fedora kexec-tools I wanted to drop mkdumprd, use kdumpctl only, but for safe we keep it maybe someone use mkdumprd seperately, one can use mkdumprd to generate kdump initrd without kdumpctl. If we pass extra things via KDUMP_TARGETS then it seems changes the behavior.
BTW, in mkdumprd we already have for_each_block_target which can be used for this purpose without extra functions?
- fi
+}
+# Collect targets(not only dump target) that will be recognized under kdump. +collect_kdump_targets() +{
- local _target _root
- # Do not care about fadump
- if [ $DEFAULT_DUMP_MODE == "fadump" ]; then
return
- fi
- _target=$(get_block_dump_target)
- if [ -n "$_target" ]; then
collect_kdump_target $_target
- elif is_ssh_dump_target; then
collect_kdump_target "ssh"
- else
collect_kdump_target "nfs"
- fi
- # Add the root device if dump_to_rootfs is specified.
- ! is_dump_to_rootfs && return
- _root=$(get_root_fs_device)
- [[ "$_root" = "$_target" ]] && return
- if [[ -b "$_root" ]]; then
collect_kdump_target $_root
- else
collect_kdump_target "nfs"
- 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.
+}
check_files_modified() { local modified_files="" @@ -693,6 +747,8 @@ check_rebuild() return 1 fi
- collect_kdump_targets
- # Will not rebuild kdump initrd if [ "$force_no_rebuild" == "1" ]; then 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/03/2017 at 01:50 PM, Dave Young wrote:
Hi Xunlei, On 06/30/17 at 11:18am, Xunlei Pang wrote:
We need to know all the kdump targets(not only dump target), this is useful for us to do some extra work related to the type of different targets.
It is not clear what is "all the kdump targets", can you add more words in patchlog?
Looks like it includes dump target and dump_to_rootfs from the code. It is better to add the purpose as well why we need this..
Will improve
Signed-off-by: Xunlei Pang xlpang@redhat.com
kdumpctl | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+)
diff --git a/kdumpctl b/kdumpctl index 0e53793..221b461 100755 --- a/kdumpctl +++ b/kdumpctl @@ -452,6 +452,60 @@ setup_initrd() fi }
+collect_kdump_target() +{
- local _dev=$1
- if [ -b "$_dev" ]; then
_dev=$(get_persistent_dev $_dev)
- fi
- # Use export to let mkdumprd(etc) also know it.
- if [ -n "$KDUMP_TARGETS" ]; then
export KDUMP_TARGETS="$KDUMP_TARGETS $_dev"
- else
export KDUMP_TARGETS="$_dev"
Assume this is for export shared variable for mkdumprd.
Originally in the initial phase of Fedora kexec-tools I wanted to drop mkdumprd, use kdumpctl only, but for safe we keep it maybe someone use mkdumprd seperately, one can use mkdumprd to generate kdump initrd without kdumpctl. If we pass extra things via KDUMP_TARGETS then it seems changes the behavior.
This is indeed a small issue.
BTW, in mkdumprd we already have for_each_block_target which can be used for this purpose without extra functions?
It's a bit different, we also want to know ssh/nfs target which is non-block.
To solve these issues, I think we can introduce a helper in kdump-lib.sh like get_kdump_targets(), and call it separately instead of exporting it as a shared variable, we also can refactor for_each_block_target() using this new get_kdump_targets().
Besides, we need a neat way to judge if it is fadump.
Regards, Xunlei
- fi
+}
+# Collect targets(not only dump target) that will be recognized under kdump. +collect_kdump_targets() +{
- local _target _root
- # Do not care about fadump
- if [ $DEFAULT_DUMP_MODE == "fadump" ]; then
return
- fi
- _target=$(get_block_dump_target)
- if [ -n "$_target" ]; then
collect_kdump_target $_target
- elif is_ssh_dump_target; then
collect_kdump_target "ssh"
- else
collect_kdump_target "nfs"
- fi
- # Add the root device if dump_to_rootfs is specified.
- ! is_dump_to_rootfs && return
- _root=$(get_root_fs_device)
- [[ "$_root" = "$_target" ]] && return
- if [[ -b "$_root" ]]; then
collect_kdump_target $_root
- else
collect_kdump_target "nfs"
- 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.
+}
check_files_modified() { local modified_files="" @@ -693,6 +747,8 @@ check_rebuild() return 1 fi
- collect_kdump_targets
- # Will not rebuild kdump initrd if [ "$force_no_rebuild" == "1" ]; then 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/03/17 at 02:32pm, Xunlei Pang wrote:
On 07/03/2017 at 01:50 PM, Dave Young wrote:
Hi Xunlei, On 06/30/17 at 11:18am, Xunlei Pang wrote:
We need to know all the kdump targets(not only dump target), this is useful for us to do some extra work related to the type of different targets.
It is not clear what is "all the kdump targets", can you add more words in patchlog?
Looks like it includes dump target and dump_to_rootfs from the code. It is better to add the purpose as well why we need this..
Will improve
Signed-off-by: Xunlei Pang xlpang@redhat.com
kdumpctl | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+)
diff --git a/kdumpctl b/kdumpctl index 0e53793..221b461 100755 --- a/kdumpctl +++ b/kdumpctl @@ -452,6 +452,60 @@ setup_initrd() fi }
+collect_kdump_target() +{
- local _dev=$1
- if [ -b "$_dev" ]; then
_dev=$(get_persistent_dev $_dev)
- fi
- # Use export to let mkdumprd(etc) also know it.
- if [ -n "$KDUMP_TARGETS" ]; then
export KDUMP_TARGETS="$KDUMP_TARGETS $_dev"
- else
export KDUMP_TARGETS="$_dev"
Assume this is for export shared variable for mkdumprd.
Originally in the initial phase of Fedora kexec-tools I wanted to drop mkdumprd, use kdumpctl only, but for safe we keep it maybe someone use mkdumprd seperately, one can use mkdumprd to generate kdump initrd without kdumpctl. If we pass extra things via KDUMP_TARGETS then it seems changes the behavior.
This is indeed a small issue.
BTW, in mkdumprd we already have for_each_block_target which can be used for this purpose without extra functions?
It's a bit different, we also want to know ssh/nfs target which is non-block.
To solve these issues, I think we can introduce a helper in kdump-lib.sh like get_kdump_targets(), and call it separately instead of exporting it as a shared variable, we also can refactor for_each_block_target() using this new get_kdump_targets().
Yes, I have same thought to call it separately instead of sharing things between different scripts.
About the networking targets, since they can be easily detected so they should be not a big problem to handle separately if we have to do something like omit some network modules etc. If so maybe only the block target in a general function helper.
Besides, we need a neat way to judge if it is fadump.
Regards, Xunlei
- fi
+}
+# Collect targets(not only dump target) that will be recognized under kdump. +collect_kdump_targets() +{
- local _target _root
- # Do not care about fadump
- if [ $DEFAULT_DUMP_MODE == "fadump" ]; then
return
- fi
- _target=$(get_block_dump_target)
- if [ -n "$_target" ]; then
collect_kdump_target $_target
- elif is_ssh_dump_target; then
collect_kdump_target "ssh"
- else
collect_kdump_target "nfs"
- fi
- # Add the root device if dump_to_rootfs is specified.
- ! is_dump_to_rootfs && return
- _root=$(get_root_fs_device)
- [[ "$_root" = "$_target" ]] && return
- if [[ -b "$_root" ]]; then
collect_kdump_target $_root
- else
collect_kdump_target "nfs"
- 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.
+}
check_files_modified() { local modified_files="" @@ -693,6 +747,8 @@ check_rebuild() return 1 fi
- collect_kdump_targets
- # Will not rebuild kdump initrd if [ "$force_no_rebuild" == "1" ]; then 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
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
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 | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
diff --git a/kdumpctl b/kdumpctl index 221b461..7cbef2e 100755 --- a/kdumpctl +++ b/kdumpctl @@ -176,6 +176,42 @@ is_dump_to_rootfs() grep "^default[[:space:]]dump_to_rootfs" /etc/kdump.conf >/dev/null }
+# Generate rd.lvm.lv=X for the kdump targets if any. +generate_lvm_cmdline() +{ + local dev=$1 + local vg lv cmdline dir_s dev_s + + ! [ -b $dev ] && return + + 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 + cmdline="rd.lvm.lv=$vg/$lv" + fi + + dev=$(get_maj_min $dev) + [[ -d /sys/dev/block/$dev/slaves ]] || return + for dir_s in /sys/dev/block/$dev/slaves/*; do + dev_s=$(< "$dir_s/dev") + dev_s=$(get_persistent_dev dev_s) + cmdline="$cmdline $(generate_lvm_cmdline $dev_s)" + done + + [ -n "$cmdline" ] && echo "$cmdline" +} + +generate_lvm_cmdlines() +{ + local target cmdlines + + for target in "$KDUMP_TARGETS"; do + cmdlines="$cmdlines $(generate_lvm_cmdline $target)" + done + + [ -n "$cmdlines" ] && echo "$cmdlines" +} + # This function performs a series of edits on the command line. # Store the final result in global $KDUMP_COMMANDLINE. prepare_cmdline() @@ -204,6 +240,10 @@ prepare_cmdline() cmdline=`remove_cmdline_param "$cmdline" root` fi
+ # Remove all the inherited rd.lvm.lv=X and generate those as needed. + cmdline=`remove_cmdline_param "$cmdline" rd.lvm.lv` + cmdline="${cmdline} $(generate_lvm_cmdlines)" + cmdline="${cmdline} ${KDUMP_COMMANDLINE_APPEND}"
id=`get_bootcpu_initial_apicid`
Hi Xunlei, On 06/30/17 at 11:18am, Xunlei Pang wrote:
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 | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
diff --git a/kdumpctl b/kdumpctl index 221b461..7cbef2e 100755 --- a/kdumpctl +++ b/kdumpctl @@ -176,6 +176,42 @@ is_dump_to_rootfs() grep "^default[[:space:]]dump_to_rootfs" /etc/kdump.conf >/dev/null }
+# Generate rd.lvm.lv=X for the kdump targets if any. +generate_lvm_cmdline() +{
- local dev=$1
- local vg lv cmdline dir_s dev_s
- ! [ -b $dev ] && return
- 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
cmdline="rd.lvm.lv=$vg/$lv"
- fi
- dev=$(get_maj_min $dev)
- [[ -d /sys/dev/block/$dev/slaves ]] || return
- for dir_s in /sys/dev/block/$dev/slaves/*; do
dev_s=$(< "$dir_s/dev")
dev_s=$(get_persistent_dev dev_s)
cmdline="$cmdline $(generate_lvm_cmdline $dev_s)"
- done
- [ -n "$cmdline" ] && echo "$cmdline"
+}
+generate_lvm_cmdlines() +{
- local target cmdlines
- for target in "$KDUMP_TARGETS"; do
cmdlines="$cmdlines $(generate_lvm_cmdline $target)"
- done
Can we use the "for_each_block_target" function for this?
- [ -n "$cmdlines" ] && echo "$cmdlines"
+}
# This function performs a series of edits on the command line. # Store the final result in global $KDUMP_COMMANDLINE. prepare_cmdline() @@ -204,6 +240,10 @@ prepare_cmdline() cmdline=`remove_cmdline_param "$cmdline" root` fi
# Remove all the inherited rd.lvm.lv=X and generate those as needed.
cmdline=`remove_cmdline_param "$cmdline" rd.lvm.lv`
cmdline="${cmdline} $(generate_lvm_cmdlines)"
cmdline="${cmdline} ${KDUMP_COMMANDLINE_APPEND}"
id=`get_bootcpu_initial_apicid`
-- 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/03/2017 at 01:52 PM, Dave Young wrote:
Hi Xunlei, On 06/30/17 at 11:18am, Xunlei Pang wrote:
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 | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
diff --git a/kdumpctl b/kdumpctl index 221b461..7cbef2e 100755 --- a/kdumpctl +++ b/kdumpctl @@ -176,6 +176,42 @@ is_dump_to_rootfs() grep "^default[[:space:]]dump_to_rootfs" /etc/kdump.conf >/dev/null }
+# Generate rd.lvm.lv=X for the kdump targets if any. +generate_lvm_cmdline() +{
- local dev=$1
- local vg lv cmdline dir_s dev_s
- ! [ -b $dev ] && return
- 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
cmdline="rd.lvm.lv=$vg/$lv"
- fi
- dev=$(get_maj_min $dev)
- [[ -d /sys/dev/block/$dev/slaves ]] || return
- for dir_s in /sys/dev/block/$dev/slaves/*; do
dev_s=$(< "$dir_s/dev")
dev_s=$(get_persistent_dev dev_s)
cmdline="$cmdline $(generate_lvm_cmdline $dev_s)"
- done
- [ -n "$cmdline" ] && echo "$cmdline"
+}
+generate_lvm_cmdlines() +{
- local target cmdlines
- for target in "$KDUMP_TARGETS"; do
cmdlines="$cmdlines $(generate_lvm_cmdline $target)"
- done
Can we use the "for_each_block_target" function for this?
I thought about it before, but I didn't find a good way to pass back the generated cmdline without using tmp file or shared variables. Do you have any good idea?
Regards, Xunlei
- [ -n "$cmdlines" ] && echo "$cmdlines"
+}
# This function performs a series of edits on the command line. # Store the final result in global $KDUMP_COMMANDLINE. prepare_cmdline() @@ -204,6 +240,10 @@ prepare_cmdline() cmdline=`remove_cmdline_param "$cmdline" root` fi
# Remove all the inherited rd.lvm.lv=X and generate those as needed.
cmdline=`remove_cmdline_param "$cmdline" rd.lvm.lv`
cmdline="${cmdline} $(generate_lvm_cmdlines)"
cmdline="${cmdline} ${KDUMP_COMMANDLINE_APPEND}"
id=`get_bootcpu_initial_apicid`
-- 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/03/17 at 02:35pm, Xunlei Pang wrote:
On 07/03/2017 at 01:52 PM, Dave Young wrote:
Hi Xunlei, On 06/30/17 at 11:18am, Xunlei Pang wrote:
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 | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
diff --git a/kdumpctl b/kdumpctl index 221b461..7cbef2e 100755 --- a/kdumpctl +++ b/kdumpctl @@ -176,6 +176,42 @@ is_dump_to_rootfs() grep "^default[[:space:]]dump_to_rootfs" /etc/kdump.conf >/dev/null }
+# Generate rd.lvm.lv=X for the kdump targets if any. +generate_lvm_cmdline() +{
- local dev=$1
- local vg lv cmdline dir_s dev_s
- ! [ -b $dev ] && return
- 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
cmdline="rd.lvm.lv=$vg/$lv"
- fi
- dev=$(get_maj_min $dev)
- [[ -d /sys/dev/block/$dev/slaves ]] || return
- for dir_s in /sys/dev/block/$dev/slaves/*; do
dev_s=$(< "$dir_s/dev")
dev_s=$(get_persistent_dev dev_s)
cmdline="$cmdline $(generate_lvm_cmdline $dev_s)"
- done
- [ -n "$cmdline" ] && echo "$cmdline"
+}
+generate_lvm_cmdlines() +{
- local target cmdlines
- for target in "$KDUMP_TARGETS"; do
cmdlines="$cmdlines $(generate_lvm_cmdline $target)"
- done
Can we use the "for_each_block_target" function for this?
I thought about it before, but I didn't find a good way to pass back the generated cmdline without using tmp file or shared variables. Do you have any good idea?
for_each_block_target is using check_block_and_slaves which will return as long as condition matches. For this cmdline case we need iterate all items so should try check_block_and_slaves_all instead. Maybe like in dracut.sh for collecting all the host_fs_types. I do not try it just an idea.
About passing the cmdline, does a shared variables work? like the host_fs_types in dracut..
Regards, Xunlei
Thanks Dave
On 07/03/17 at 04:30pm, Dave Young wrote:
On 07/03/17 at 02:35pm, Xunlei Pang wrote:
On 07/03/2017 at 01:52 PM, Dave Young wrote:
Hi Xunlei, On 06/30/17 at 11:18am, Xunlei Pang wrote:
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 | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
diff --git a/kdumpctl b/kdumpctl index 221b461..7cbef2e 100755 --- a/kdumpctl +++ b/kdumpctl @@ -176,6 +176,42 @@ is_dump_to_rootfs() grep "^default[[:space:]]dump_to_rootfs" /etc/kdump.conf >/dev/null }
+# Generate rd.lvm.lv=X for the kdump targets if any. +generate_lvm_cmdline() +{
- local dev=$1
- local vg lv cmdline dir_s dev_s
- ! [ -b $dev ] && return
- 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
cmdline="rd.lvm.lv=$vg/$lv"
- fi
- dev=$(get_maj_min $dev)
- [[ -d /sys/dev/block/$dev/slaves ]] || return
- for dir_s in /sys/dev/block/$dev/slaves/*; do
dev_s=$(< "$dir_s/dev")
dev_s=$(get_persistent_dev dev_s)
cmdline="$cmdline $(generate_lvm_cmdline $dev_s)"
- done
- [ -n "$cmdline" ] && echo "$cmdline"
+}
+generate_lvm_cmdlines() +{
- local target cmdlines
- for target in "$KDUMP_TARGETS"; do
cmdlines="$cmdlines $(generate_lvm_cmdline $target)"
- done
Can we use the "for_each_block_target" function for this?
I thought about it before, but I didn't find a good way to pass back the generated cmdline without using tmp file or shared variables. Do you have any good idea?
for_each_block_target is using check_block_and_slaves which will return as long as condition matches. For this cmdline case we need iterate all items so should try check_block_and_slaves_all instead. Maybe like in dracut.sh for collecting all the host_fs_types. I do not try it just an idea.
About passing the cmdline, does a shared variables work? like the host_fs_types in dracut..
Hmm, I actually means not sharing things between files, ie. for_each_xxx function $param
the function should be defined in kdumpctl then it can use any vars defined in kdumpctl so no need share anything?
Regards, Xunlei
Thanks Dave _______________________________________________ kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org
On 07/03/2017 at 04:36 PM, Dave Young wrote:
On 07/03/17 at 04:30pm, Dave Young wrote:
On 07/03/17 at 02:35pm, Xunlei Pang wrote:
On 07/03/2017 at 01:52 PM, Dave Young wrote:
Hi Xunlei, On 06/30/17 at 11:18am, Xunlei Pang wrote:
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 | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
diff --git a/kdumpctl b/kdumpctl index 221b461..7cbef2e 100755 --- a/kdumpctl +++ b/kdumpctl @@ -176,6 +176,42 @@ is_dump_to_rootfs() grep "^default[[:space:]]dump_to_rootfs" /etc/kdump.conf >/dev/null }
+# Generate rd.lvm.lv=X for the kdump targets if any. +generate_lvm_cmdline() +{
- local dev=$1
- local vg lv cmdline dir_s dev_s
- ! [ -b $dev ] && return
- 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
cmdline="rd.lvm.lv=$vg/$lv"
- fi
- dev=$(get_maj_min $dev)
- [[ -d /sys/dev/block/$dev/slaves ]] || return
- for dir_s in /sys/dev/block/$dev/slaves/*; do
dev_s=$(< "$dir_s/dev")
dev_s=$(get_persistent_dev dev_s)
cmdline="$cmdline $(generate_lvm_cmdline $dev_s)"
- done
- [ -n "$cmdline" ] && echo "$cmdline"
+}
+generate_lvm_cmdlines() +{
- local target cmdlines
- for target in "$KDUMP_TARGETS"; do
cmdlines="$cmdlines $(generate_lvm_cmdline $target)"
- done
Can we use the "for_each_block_target" function for this?
I thought about it before, but I didn't find a good way to pass back the generated cmdline without using tmp file or shared variables. Do you have any good idea?
for_each_block_target is using check_block_and_slaves which will return as long as condition matches. For this cmdline case we need iterate all items so should try check_block_and_slaves_all instead. Maybe like in dracut.sh for collecting all the host_fs_types. I do not try it just an idea.
About passing the cmdline, does a shared variables work? like the host_fs_types in dracut..
Hmm, I actually means not sharing things between files, ie. for_each_xxx function $param
the function should be defined in kdumpctl then it can use any vars defined in kdumpctl so no need share anything?
We still need a global variable defined in kdumpctl to store the string generated by the function. If you think it is ok, I can go with that. Thanks!
Regards, Xunlei
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 --- mkdumprd | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
diff --git a/mkdumprd b/mkdumprd index 45b185a..97722df 100644 --- a/mkdumprd +++ b/mkdumprd @@ -401,6 +401,30 @@ check_crypt() return 1 }
+omit_dracut_modules() +{ + local target majmin + local has_crypt + + # Skip fadump case + [ -z "$KDUMP_TARGETS" ] && return + + has_crypt=0 + + for target in $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 @@ -490,6 +514,8 @@ then add_dracut_arg "--add-drivers" "$extra_modules" fi
+omit_dracut_modules + dracut "${dracut_args[@]}" "$@" _rc=$? sync
On 06/30/2017 at 11:18 AM, 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.
We can continue omitting more dracut modules after this series is accepted, to reduce kdump initramfs size(thus kdump memory), something like below can save several MiB tested on my x86_64 fedora KVM: diff --git a/mkdumprd b/mkdumprd index 97722df..54d45c9 100644 --- a/mkdumprd +++ b/mkdumprd @@ -401,28 +401,55 @@ 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 all_nfs_ssh
# Skip fadump case [ -z "$KDUMP_TARGETS" ] && return
has_crypt=0 + has_lvm=0 + all_nfs_ssh=1
for target in $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 + + # Check nfs/ssh dumping + [[ "$target" != "nfs" && "$target" != "ssh" ]] && all_nfs_ssh=0 done
# Omit "crypt", BZ1451717 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 + 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 + add_dracut_arg "--omit" "iscsi fcoe" + fi }
Signed-off-by: Xunlei Pang xlpang@redhat.com
mkdumprd | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
diff --git a/mkdumprd b/mkdumprd index 45b185a..97722df 100644 --- a/mkdumprd +++ b/mkdumprd @@ -401,6 +401,30 @@ check_crypt() return 1 }
+omit_dracut_modules() +{
- local target majmin
- local has_crypt
- # Skip fadump case
- [ -z "$KDUMP_TARGETS" ] && return
- has_crypt=0
- for target in $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 @@ -490,6 +514,8 @@ then add_dracut_arg "--add-drivers" "$extra_modules" fi
+omit_dracut_modules
dracut "${dracut_args[@]}" "$@" _rc=$? sync
On 06/30/2017 at 11:55 AM, Xunlei Pang wrote:
On 06/30/2017 at 11:18 AM, 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.
We can continue omitting more dracut modules after this series is accepted, to reduce kdump initramfs size(thus kdump memory), something like below can save several MiB tested on my x86_64 fedora KVM:
I mean for nfs/ssh dumping, or non-lvm dumping(like dump to /dev/sdaX).
diff --git a/mkdumprd b/mkdumprd index 97722df..54d45c9 100644 --- a/mkdumprd +++ b/mkdumprd @@ -401,28 +401,55 @@ 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 all_nfs_ssh
# Skip fadump case [ -z "$KDUMP_TARGETS" ] && return
has_crypt=0
has_lvm=0
all_nfs_ssh=1
for target in $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
# Check nfs/ssh dumping
[[ "$target" != "nfs" && "$target" != "ssh" ]] && all_nfs_ssh=0
done
# Omit "crypt", BZ1451717 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
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
add_dracut_arg "--omit" "iscsi fcoe"
fi
}
Signed-off-by: Xunlei Pang xlpang@redhat.com
mkdumprd | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
diff --git a/mkdumprd b/mkdumprd index 45b185a..97722df 100644 --- a/mkdumprd +++ b/mkdumprd @@ -401,6 +401,30 @@ check_crypt() return 1 }
+omit_dracut_modules() +{
- local target majmin
- local has_crypt
- # Skip fadump case
- [ -z "$KDUMP_TARGETS" ] && return
- has_crypt=0
- for target in $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 @@ -490,6 +514,8 @@ then add_dracut_arg "--add-drivers" "$extra_modules" fi
+omit_dracut_modules
dracut "${dracut_args[@]}" "$@" _rc=$? sync
On 06/30/17 at 11:18am, 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.
Xunlei, it can save memory, but if there is no crypt target why still asking user for password?
Signed-off-by: Xunlei Pang xlpang@redhat.com
mkdumprd | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
diff --git a/mkdumprd b/mkdumprd index 45b185a..97722df 100644 --- a/mkdumprd +++ b/mkdumprd @@ -401,6 +401,30 @@ check_crypt() return 1 }
+omit_dracut_modules() +{
- local target majmin
- local has_crypt
- # Skip fadump case
- [ -z "$KDUMP_TARGETS" ] && return
- has_crypt=0
- for target in $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 @@ -490,6 +514,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
On 07/03/2017 at 11:24 AM, Dave Young wrote:
On 06/30/17 at 11:18am, 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.
Xunlei, it can save memory, but if there is no crypt target why still asking user for password?
Once dracut added "crypt" module to kdump, it will parse "rd.luks.uuid=X" as well as "/etc/crypttab" and pop up asking the password.
Regards, Xunlei
Signed-off-by: Xunlei Pang xlpang@redhat.com
mkdumprd | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
diff --git a/mkdumprd b/mkdumprd index 45b185a..97722df 100644 --- a/mkdumprd +++ b/mkdumprd @@ -401,6 +401,30 @@ check_crypt() return 1 }
+omit_dracut_modules() +{
- local target majmin
- local has_crypt
- # Skip fadump case
- [ -z "$KDUMP_TARGETS" ] && return
- has_crypt=0
- for target in $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 @@ -490,6 +514,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
On 07/03/17 at 11:57am, Xunlei Pang wrote:
On 07/03/2017 at 11:24 AM, Dave Young wrote:
On 06/30/17 at 11:18am, 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.
Xunlei, it can save memory, but if there is no crypt target why still asking user for password?
Once dracut added "crypt" module to kdump, it will parse "rd.luks.uuid=X" as well as "/etc/crypttab" and pop up asking the password.
But who provide rd.luks, hostonly added some crypt mount?
Thanks Dave
On 07/03/2017 at 01:16 PM, Dave Young wrote:
On 07/03/17 at 11:57am, Xunlei Pang wrote:
On 07/03/2017 at 11:24 AM, Dave Young wrote:
On 06/30/17 at 11:18am, 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.
Xunlei, it can save memory, but if there is no crypt target why still asking user for password?
Once dracut added "crypt" module to kdump, it will parse "rd.luks.uuid=X" as well as "/etc/crypttab" and pop up asking the password.
But who provide rd.luks, hostonly added some crypt mount?
It's inherited from the first kernel cmdline, for example: # cat /proc/cmdline BOOT_IMAGE=/vmlinuz-4.8.6-300.fc25.x86_64 root=/dev/mapper/fedora-root ro rd.lvm.lv=fedora/root rd.luks.uuid=luks-d868b8b9-275c-4a71-8709-23a403bcf57e rd.lvm.lv=fedora/swap rhgb quiet LANG=en_US.UTF-8 crashkernel=161M console=ttyS0,115200
Regards, Xunlei