There are some complaints about nfs kdump that users must mount nfs beforehand, which may cause some overhead to nfs server. For example, there're thounsands of clients deployed with kdump diskless boot, each time the client is boot up, it will trigger kdump rebuilding so will mount nfs, thus resulting in thousands of nfs request concurrently imposed on the same nfs server.
We introduce a new way of specifying mount information via the already-existent "dracut_args" directive(so avoid adding extra directives in /etc/kdump.conf), we will skip all the filesystem mounting and checking stuff for it. So it can be used in the above-mentioned nfs scenario to avoid severe nfs server overhead.
Specifically, if there is any "--mount" information specified via "dracut_args" in /etc/kdump.conf, always use it as the final mount without any validation(mounting or checking like mount options, fs size, etc), so users are expected to ensure its correctness.
As an example: dracut_args --mount "192.168.1.1:/test test nfs defaults"
NOTE: -Only one mount information is allowed using "dracut_args". -Dracut will create <mountpoint> if it doesn't exist in kdump kernel. -Users should do a test first and ensure it works because kdump does not prepare the mount and check all the validity.
Suggested-by: Dave Young dyoung@redhat.com Signed-off-by: Xunlei Pang xlpang@redhat.com --- dracut-kdump.sh | 6 +++++- dracut-module-setup.sh | 6 ++++++ kdump-lib.sh | 31 ++++++++++++++++++++++++++++++- kdumpctl | 13 ++++++++++++- mkdumprd | 5 +++++ 5 files changed, 58 insertions(+), 3 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh index 4aab205..c5bd4a6 100755 --- a/dracut-kdump.sh +++ b/dracut-kdump.sh @@ -117,7 +117,7 @@ save_vmcore_dmesg_ssh() { get_host_ip() { local _host - if is_nfs_dump_target || is_ssh_dump_target + if is_nfs_dump_target || is_ssh_dump_target || dracut_args_contains_nfsmount then kdumpnic=$(getarg kdumpnic=) [ -z "$kdumpnic" ] && echo "kdump: failed to get kdumpnic!" && return 1 @@ -146,6 +146,10 @@ read_kdump_conf() # remove inline comments after the end of a directive. config_val=$(strip_comments $config_val) case "$config_opt" in + dracut_args) + config_val=$(get_target_from_dracut_args_val "$config_val") + [[ -n "$config_val" ]] && add_dump_code "dump_fs $config_val" + ;; ext[234]|xfs|btrfs|minix|nfs) add_dump_code "dump_fs $config_val" ;; diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 4cd7107..a95e87b 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -433,6 +433,11 @@ kdump_install_conf() { ssh|nfs) kdump_install_net "$config_val" ;; + dracut_args) + if [[ $(get_fstype_from_dracut_args_val "$config_val") = nfs* ]]; then + kdump_install_net "$(get_target_from_dracut_args_val "$config_val")" + fi + ;; kdump_pre|kdump_post|extra_bins) dracut_install $config_val ;; @@ -684,6 +689,7 @@ install() { inst "/bin/date" "/bin/date" inst "/bin/sync" "/bin/sync" inst "/bin/cut" "/bin/cut" + inst "/usr/bin/awk" "/usr/bin/awk" inst "/bin/head" "/bin/head" inst "/sbin/makedumpfile" "/sbin/makedumpfile" inst "/sbin/vmcore-dmesg" "/sbin/vmcore-dmesg" diff --git a/kdump-lib.sh b/kdump-lib.sh index fc2c036..39a2d00 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -45,7 +45,8 @@ is_fs_dump_target()
is_user_configured_dump_target() { - return $(is_ssh_dump_target || is_nfs_dump_target || is_raw_dump_target || is_fs_dump_target) + return $(dracut_args_contains_mount || is_ssh_dump_target || is_nfs_dump_target || \ + is_raw_dump_target || is_fs_dump_target) }
strip_comments() @@ -279,3 +280,31 @@ is_hostname() fi echo $1 | grep -q "[a-zA-Z]" } + +# If "dracut_args" contains "--mount" information, use it +# directly without any check(users are expected to ensure +# its correctness). +dracut_args_contains_mount() +{ + return $(grep ^dracut_args /etc/kdump.conf | grep -q "--mount") +} + +dracut_args_contains_nfsmount() +{ + local config_val + + config_val=$(grep ^dracut_args /etc/kdump.conf | awk -F "--mount "" '{print $2}' | cut -d' ' -f3) + [[ $config_val = nfs* ]] && return 0 + + return 1 +} + +get_fstype_from_dracut_args_val() +{ + echo $1 | awk -F "--mount "" '{print $2}' | cut -d' ' -f3 +} + +get_target_from_dracut_args_val() +{ + echo $1 | awk -F "--mount "" '{print $2}' | cut -d' ' -f1 +} diff --git a/kdumpctl b/kdumpctl index fcc9ad0..aa8232c 100755 --- a/kdumpctl +++ b/kdumpctl @@ -236,12 +236,18 @@ check_config() { local nr
- nr=$(awk 'BEGIN{cnt=0} /^raw|^ssh[[:blank:]]|^nfs|^ext[234]|^xfs|^btrfs|^minix/{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE) + nr=$(awk 'BEGIN{cnt=0} /^raw|^ssh[[:blank:]]|^nfs|^ext[234]|^xfs|^btrfs|^minix|^dracut_args .*--mount/{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE) [ $nr -gt 1 ] && { echo "More than one dump targets specified." return 1 }
+ nr=$(grep "^dracut_args .*--mount" $KDUMP_CONFIG_FILE | grep -o "--mount" | wc -l) + [ $nr -gt 1 ] && { + echo "More than one mount targets specified in "dracut_args"." + return 1 + } + while read config_opt config_val; do # remove inline comments after the end of a directive. config_val=$(strip_comments $config_val) @@ -365,6 +371,11 @@ check_dump_fs_modified() local _new_dev _new_mntpoint _new_fstype local _target _path _dracut_args
+ # No need to check in case of mount target specified via "dracut_args". + if dracut_args_contains_mount; then + return 0 + fi + # No need to check in case of raw target. # Currently we do not check also if ssh/nfs target is specified if is_ssh_dump_target || is_nfs_dump_target || is_raw_dump_target; then diff --git a/mkdumprd b/mkdumprd index 78afb1a..573da96 100644 --- a/mkdumprd +++ b/mkdumprd @@ -544,6 +544,11 @@ do verify_core_collector "$config_val" ;; dracut_args) + if [[ $(get_fstype_from_dracut_args_val "$config_val") = nfs* ]]; then + add_dracut_module "nfs" + # nfs may not be mounted, we need to add nfs related modules explicitly. + add_dracut_arg "--add-drivers" "nfs nfsv4" + fi add_dracut_arg $config_val ;; *)
Update "kexec-kdump-howto", as well as "kdump.conf" and its man page.
Signed-off-by: Xunlei Pang xlpang@redhat.com --- kdump.conf | 17 +++++++++++++++++ kdump.conf.5 | 17 +++++++++++++++++ kexec-kdump-howto.txt | 21 +++++++++++++++++++++ 3 files changed, 55 insertions(+)
diff --git a/kdump.conf b/kdump.conf index 54b581d..ed20f71 100644 --- a/kdump.conf +++ b/kdump.conf @@ -133,6 +133,23 @@ # - Pass extra dracut options when rebuilding kdump # initrd. # +# Users can utilize this directive to pass "--mount" to kdump, +# please refer to "man dracut" for the format of "--mount" argument. +# If there is any "--mount" specified via "dracut_args", kdump +# always uses it as the final mount target without any validation +# (mounting or checking like mount options, fs size, save path, etc), +# so users are expected to ensure all its correctness. It conflicts +# with targets specified via "ext[234]/xfs/btrfs/nfs". +# +# As an nfs example: +# dracut_args --mount "192.168.1.1:/test test nfs defaults,x-initrd.mount" +# +# NOTE: +# -Only one mount target is allowed using "dracut_args" globally. +# -Dracut will create <mountpoint> if it doesn't exist in kdump kernel. +# -Users should do a test first and ensure it works because kdump does +# not prepare the mount and check all the validity. +# # fence_kdump_args <arg(s)> # - Command line arguments for fence_kdump_send (it can contain # all valid arguments except hosts to send notification to). diff --git a/kdump.conf.5 b/kdump.conf.5 index f1c2a2c..7b5b0ba 100644 --- a/kdump.conf.5 +++ b/kdump.conf.5 @@ -183,6 +183,23 @@ to try dumping. By default, it's set to 0, means not to try a destined failure. .RS Kdump uses dracut to generate initramfs for second kernel. This option allows a user to pass arguments to dracut directly. + +Users can utilize this directive to pass "--mount" to kdump, please refer +to "man dracut" for the format of "--mount" argument. If there is any +"--mount" specified via "dracut_args", kdump always uses it as the final +mount target without any validation(mounting or checking like mount options, +fs size, save path, etc), so users are expected to ensure all the correctness. +It conflicts with targets specified via "ext[234]/xfs/btrfs/nfs". + +As an nfs example: +dracut_args --mount "192.168.1.1:/test test nfs defaults,x-initrd.mount" + +Note 1: Only one mount target is allowed using "dracut_args" globally. + +Note 2: Dracut will create <mountpoint> if it doesn't exist in kdump kernel. + +Note 3: Users should do a test first and ensure it works because kdump does + not prepare the mount and check all the validity. .RE
diff --git a/kexec-kdump-howto.txt b/kexec-kdump-howto.txt index b4cdc22..dde95c6 100644 --- a/kexec-kdump-howto.txt +++ b/kexec-kdump-howto.txt @@ -345,6 +345,27 @@ mount the NFS mount and copy out the vmcore to your NFS server. Restart the kdump service via '/sbin/systemctl restart kdump.service' to commit this change to your kdump initrd.
+Special mount via "dracut_args" + +Kdump uses dracut to generate initramfs for second kernel. This option +allows a user to pass arguments to dracut directly. + +Users can utilize "dracut_args" to pass "--mount" to kdump, please refer +to "man dracut" for the format of "--mount" argument. If there is any +"--mount" specified via "dracut_args", kdump always uses it as the final +mount target without any validation(mounting or checking like mount options, +fs size, save path, etc), so users are expected to ensure all the correctness. +It conflicts with targets specified via "ext[234]/xfs/btrfs/nfs". + +As an nfs special mount example: +dracut_args --mount "192.168.1.1:/test test nfs defaults,x-initrd.mount" + +NOTE: +-Only one mount target is allowed using "dracut_args" globally. +-Dracut will create <mountpoint> if it doesn't exist in kdump kernel. +-Users should do a test first and ensure it works because kdump does + not prepare the mount and check all the validity. + Remote system via ssh/scp
Dumping over ssh/scp requires setting up passwordless ssh keys for every
Hi, Xunlei
Will review the patches, but a quick comment about the doc first. It maybe not a good idea to advertise the --mount usage since it skips kdump logic without any checking and setup. It can be a way to address issues we do not support like the nfs-mount-before-build-kdump-initrd issue.
So how about only documenting it in howto.txt, and drop the kdump.conf and manpage part.
On 05/23/16 at 03:06pm, Xunlei Pang wrote:
Update "kexec-kdump-howto", as well as "kdump.conf" and its man page.
Signed-off-by: Xunlei Pang xlpang@redhat.com
kdump.conf | 17 +++++++++++++++++ kdump.conf.5 | 17 +++++++++++++++++ kexec-kdump-howto.txt | 21 +++++++++++++++++++++ 3 files changed, 55 insertions(+)
diff --git a/kdump.conf b/kdump.conf index 54b581d..ed20f71 100644 --- a/kdump.conf +++ b/kdump.conf @@ -133,6 +133,23 @@ # - Pass extra dracut options when rebuilding kdump # initrd. # +# Users can utilize this directive to pass "--mount" to kdump, +# please refer to "man dracut" for the format of "--mount" argument. +# If there is any "--mount" specified via "dracut_args", kdump +# always uses it as the final mount target without any validation +# (mounting or checking like mount options, fs size, save path, etc), +# so users are expected to ensure all its correctness. It conflicts +# with targets specified via "ext[234]/xfs/btrfs/nfs". +# +# As an nfs example: +# dracut_args --mount "192.168.1.1:/test test nfs defaults,x-initrd.mount" +# +# NOTE: +# -Only one mount target is allowed using "dracut_args" globally. +# -Dracut will create <mountpoint> if it doesn't exist in kdump kernel. +# -Users should do a test first and ensure it works because kdump does +# not prepare the mount and check all the validity. +# # fence_kdump_args <arg(s)> # - Command line arguments for fence_kdump_send (it can contain # all valid arguments except hosts to send notification to). diff --git a/kdump.conf.5 b/kdump.conf.5 index f1c2a2c..7b5b0ba 100644 --- a/kdump.conf.5 +++ b/kdump.conf.5 @@ -183,6 +183,23 @@ to try dumping. By default, it's set to 0, means not to try a destined failure. .RS Kdump uses dracut to generate initramfs for second kernel. This option allows a user to pass arguments to dracut directly.
+Users can utilize this directive to pass "--mount" to kdump, please refer +to "man dracut" for the format of "--mount" argument. If there is any +"--mount" specified via "dracut_args", kdump always uses it as the final +mount target without any validation(mounting or checking like mount options, +fs size, save path, etc), so users are expected to ensure all the correctness. +It conflicts with targets specified via "ext[234]/xfs/btrfs/nfs".
+As an nfs example: +dracut_args --mount "192.168.1.1:/test test nfs defaults,x-initrd.mount"
+Note 1: Only one mount target is allowed using "dracut_args" globally.
+Note 2: Dracut will create <mountpoint> if it doesn't exist in kdump kernel.
+Note 3: Users should do a test first and ensure it works because kdump does
not prepare the mount and check all the validity.
.RE
diff --git a/kexec-kdump-howto.txt b/kexec-kdump-howto.txt index b4cdc22..dde95c6 100644 --- a/kexec-kdump-howto.txt +++ b/kexec-kdump-howto.txt @@ -345,6 +345,27 @@ mount the NFS mount and copy out the vmcore to your NFS server. Restart the kdump service via '/sbin/systemctl restart kdump.service' to commit this change to your kdump initrd.
+Special mount via "dracut_args"
+Kdump uses dracut to generate initramfs for second kernel. This option +allows a user to pass arguments to dracut directly.
+Users can utilize "dracut_args" to pass "--mount" to kdump, please refer +to "man dracut" for the format of "--mount" argument. If there is any +"--mount" specified via "dracut_args", kdump always uses it as the final +mount target without any validation(mounting or checking like mount options, +fs size, save path, etc), so users are expected to ensure all the correctness. +It conflicts with targets specified via "ext[234]/xfs/btrfs/nfs".
+As an nfs special mount example: +dracut_args --mount "192.168.1.1:/test test nfs defaults,x-initrd.mount"
+NOTE: +-Only one mount target is allowed using "dracut_args" globally. +-Dracut will create <mountpoint> if it doesn't exist in kdump kernel. +-Users should do a test first and ensure it works because kdump does
- not prepare the mount and check all the validity.
Remote system via ssh/scp
Dumping over ssh/scp requires setting up passwordless ssh keys for every
1.8.3.1
On 2016/05/23 at 16:40, Dave Young wrote:
Hi, Xunlei
Will review the patches, but a quick comment about the doc first. It maybe not a good idea to advertise the --mount usage since it skips kdump logic without any checking and setup. It can be a way to address issues we do not support like the nfs-mount-before-build-kdump-initrd issue.
So how about only documenting it in howto.txt, and drop the kdump.conf and manpage part.
Ok, I will update it after receiving more review.
Regards, Xunlei
On 05/23/16 at 03:06pm, Xunlei Pang wrote:
Update "kexec-kdump-howto", as well as "kdump.conf" and its man page.
Signed-off-by: Xunlei Pang xlpang@redhat.com
kdump.conf | 17 +++++++++++++++++ kdump.conf.5 | 17 +++++++++++++++++ kexec-kdump-howto.txt | 21 +++++++++++++++++++++ 3 files changed, 55 insertions(+)
diff --git a/kdump.conf b/kdump.conf index 54b581d..ed20f71 100644 --- a/kdump.conf +++ b/kdump.conf @@ -133,6 +133,23 @@ # - Pass extra dracut options when rebuilding kdump # initrd. # +# Users can utilize this directive to pass "--mount" to kdump, +# please refer to "man dracut" for the format of "--mount" argument. +# If there is any "--mount" specified via "dracut_args", kdump +# always uses it as the final mount target without any validation +# (mounting or checking like mount options, fs size, save path, etc), +# so users are expected to ensure all its correctness. It conflicts +# with targets specified via "ext[234]/xfs/btrfs/nfs". +# +# As an nfs example: +# dracut_args --mount "192.168.1.1:/test test nfs defaults,x-initrd.mount" +# +# NOTE: +# -Only one mount target is allowed using "dracut_args" globally. +# -Dracut will create <mountpoint> if it doesn't exist in kdump kernel. +# -Users should do a test first and ensure it works because kdump does +# not prepare the mount and check all the validity. +# # fence_kdump_args <arg(s)> # - Command line arguments for fence_kdump_send (it can contain # all valid arguments except hosts to send notification to). diff --git a/kdump.conf.5 b/kdump.conf.5 index f1c2a2c..7b5b0ba 100644 --- a/kdump.conf.5 +++ b/kdump.conf.5 @@ -183,6 +183,23 @@ to try dumping. By default, it's set to 0, means not to try a destined failure. .RS Kdump uses dracut to generate initramfs for second kernel. This option allows a user to pass arguments to dracut directly.
+Users can utilize this directive to pass "--mount" to kdump, please refer +to "man dracut" for the format of "--mount" argument. If there is any +"--mount" specified via "dracut_args", kdump always uses it as the final +mount target without any validation(mounting or checking like mount options, +fs size, save path, etc), so users are expected to ensure all the correctness. +It conflicts with targets specified via "ext[234]/xfs/btrfs/nfs".
+As an nfs example: +dracut_args --mount "192.168.1.1:/test test nfs defaults,x-initrd.mount"
+Note 1: Only one mount target is allowed using "dracut_args" globally.
+Note 2: Dracut will create <mountpoint> if it doesn't exist in kdump kernel.
+Note 3: Users should do a test first and ensure it works because kdump does
not prepare the mount and check all the validity.
.RE
diff --git a/kexec-kdump-howto.txt b/kexec-kdump-howto.txt index b4cdc22..dde95c6 100644 --- a/kexec-kdump-howto.txt +++ b/kexec-kdump-howto.txt @@ -345,6 +345,27 @@ mount the NFS mount and copy out the vmcore to your NFS server. Restart the kdump service via '/sbin/systemctl restart kdump.service' to commit this change to your kdump initrd.
+Special mount via "dracut_args"
+Kdump uses dracut to generate initramfs for second kernel. This option +allows a user to pass arguments to dracut directly.
+Users can utilize "dracut_args" to pass "--mount" to kdump, please refer +to "man dracut" for the format of "--mount" argument. If there is any +"--mount" specified via "dracut_args", kdump always uses it as the final +mount target without any validation(mounting or checking like mount options, +fs size, save path, etc), so users are expected to ensure all the correctness. +It conflicts with targets specified via "ext[234]/xfs/btrfs/nfs".
+As an nfs special mount example: +dracut_args --mount "192.168.1.1:/test test nfs defaults,x-initrd.mount"
+NOTE: +-Only one mount target is allowed using "dracut_args" globally. +-Dracut will create <mountpoint> if it doesn't exist in kdump kernel. +-Users should do a test first and ensure it works because kdump does
- not prepare the mount and check all the validity.
Remote system via ssh/scp
Dumping over ssh/scp requires setting up passwordless ssh keys for every
1.8.3.1
On 2016/05/23 at 16:40, Dave Young wrote:
Hi, Xunlei
Will review the patches, but a quick comment about the doc first. It maybe not a good idea to advertise the --mount usage since it skips kdump logic without any checking and setup. It can be a way to address issues we do not support like the nfs-mount-before-build-kdump-initrd issue.
So how about only documenting it in howto.txt, and drop the kdump.conf and manpage part.
Ok, I will update it after receiving more review.
Regards, Xunlei
On 05/23/16 at 03:06pm, Xunlei Pang wrote:
Update "kexec-kdump-howto", as well as "kdump.conf" and its man page.
Signed-off-by: Xunlei Pang xlpang@redhat.com
kdump.conf | 17 +++++++++++++++++ kdump.conf.5 | 17 +++++++++++++++++ kexec-kdump-howto.txt | 21 +++++++++++++++++++++ 3 files changed, 55 insertions(+)
diff --git a/kdump.conf b/kdump.conf index 54b581d..ed20f71 100644 --- a/kdump.conf +++ b/kdump.conf @@ -133,6 +133,23 @@ # - Pass extra dracut options when rebuilding kdump # initrd. # +# Users can utilize this directive to pass "--mount" to kdump, +# please refer to "man dracut" for the format of "--mount" argument. +# If there is any "--mount" specified via "dracut_args", kdump +# always uses it as the final mount target without any validation +# (mounting or checking like mount options, fs size, save path, etc), +# so users are expected to ensure all its correctness. It conflicts +# with targets specified via "ext[234]/xfs/btrfs/nfs". +# +# As an nfs example: +# dracut_args --mount "192.168.1.1:/test test nfs defaults,x-initrd.mount" +# +# NOTE: +# -Only one mount target is allowed using "dracut_args" globally. +# -Dracut will create <mountpoint> if it doesn't exist in kdump kernel. +# -Users should do a test first and ensure it works because kdump does +# not prepare the mount and check all the validity. +# # fence_kdump_args <arg(s)> # - Command line arguments for fence_kdump_send (it can contain # all valid arguments except hosts to send notification to). diff --git a/kdump.conf.5 b/kdump.conf.5 index f1c2a2c..7b5b0ba 100644 --- a/kdump.conf.5 +++ b/kdump.conf.5 @@ -183,6 +183,23 @@ to try dumping. By default, it's set to 0, means not to try a destined failure. .RS Kdump uses dracut to generate initramfs for second kernel. This option allows a user to pass arguments to dracut directly.
+Users can utilize this directive to pass "--mount" to kdump, please refer +to "man dracut" for the format of "--mount" argument. If there is any +"--mount" specified via "dracut_args", kdump always uses it as the final +mount target without any validation(mounting or checking like mount options, +fs size, save path, etc), so users are expected to ensure all the correctness. +It conflicts with targets specified via "ext[234]/xfs/btrfs/nfs".
+As an nfs example: +dracut_args --mount "192.168.1.1:/test test nfs defaults,x-initrd.mount"
+Note 1: Only one mount target is allowed using "dracut_args" globally.
+Note 2: Dracut will create <mountpoint> if it doesn't exist in kdump kernel.
+Note 3: Users should do a test first and ensure it works because kdump does
not prepare the mount and check all the validity.
.RE
diff --git a/kexec-kdump-howto.txt b/kexec-kdump-howto.txt index b4cdc22..dde95c6 100644 --- a/kexec-kdump-howto.txt +++ b/kexec-kdump-howto.txt @@ -345,6 +345,27 @@ mount the NFS mount and copy out the vmcore to your NFS server. Restart the kdump service via '/sbin/systemctl restart kdump.service' to commit this change to your kdump initrd.
+Special mount via "dracut_args"
+Kdump uses dracut to generate initramfs for second kernel. This option +allows a user to pass arguments to dracut directly.
+Users can utilize "dracut_args" to pass "--mount" to kdump, please refer +to "man dracut" for the format of "--mount" argument. If there is any +"--mount" specified via "dracut_args", kdump always uses it as the final +mount target without any validation(mounting or checking like mount options, +fs size, save path, etc), so users are expected to ensure all the correctness. +It conflicts with targets specified via "ext[234]/xfs/btrfs/nfs".
+As an nfs special mount example: +dracut_args --mount "192.168.1.1:/test test nfs defaults,x-initrd.mount"
+NOTE: +-Only one mount target is allowed using "dracut_args" globally. +-Dracut will create <mountpoint> if it doesn't exist in kdump kernel. +-Users should do a test first and ensure it works because kdump does
- not prepare the mount and check all the validity.
Remote system via ssh/scp
Dumping over ssh/scp requires setting up passwordless ssh keys for every
1.8.3.1
Hi Xunlei,
On 23/05/2016:03:06:01 PM, Xunlei Pang wrote:
Update "kexec-kdump-howto", as well as "kdump.conf" and its man page.
Signed-off-by: Xunlei Pang xlpang@redhat.com
kdump.conf | 17 +++++++++++++++++ kdump.conf.5 | 17 +++++++++++++++++ kexec-kdump-howto.txt | 21 +++++++++++++++++++++ 3 files changed, 55 insertions(+)
diff --git a/kdump.conf b/kdump.conf index 54b581d..ed20f71 100644 --- a/kdump.conf +++ b/kdump.conf @@ -133,6 +133,23 @@ # - Pass extra dracut options when rebuilding kdump # initrd. # +# Users can utilize this directive to pass "--mount" to kdump, +# please refer to "man dracut" for the format of "--mount" argument. +# If there is any "--mount" specified via "dracut_args", kdump +# always uses it as the final mount target without any validation +# (mounting or checking like mount options, fs size, save path, etc), +# so users are expected to ensure all its correctness. It conflicts +# with targets specified via "ext[234]/xfs/btrfs/nfs". +# +# As an nfs example: +# dracut_args --mount "192.168.1.1:/test test nfs defaults,x-initrd.mount" +# +# NOTE: +# -Only one mount target is allowed using "dracut_args" globally. +# -Dracut will create <mountpoint> if it doesn't exist in kdump kernel. +# -Users should do a test first and ensure it works because kdump does +# not prepare the mount and check all the validity. +# # fence_kdump_args <arg(s)> # - Command line arguments for fence_kdump_send (it can contain # all valid arguments except hosts to send notification to). diff --git a/kdump.conf.5 b/kdump.conf.5 index f1c2a2c..7b5b0ba 100644 --- a/kdump.conf.5 +++ b/kdump.conf.5 @@ -183,6 +183,23 @@ to try dumping. By default, it's set to 0, means not to try a destined failure. .RS Kdump uses dracut to generate initramfs for second kernel. This option allows a user to pass arguments to dracut directly.
+Users can utilize this directive to pass "--mount" to kdump, please refer +to "man dracut" for the format of "--mount" argument. If there is any +"--mount" specified via "dracut_args", kdump always uses it as the final +mount target without any validation(mounting or checking like mount options, +fs size, save path, etc), so users are expected to ensure all the correctness. +It conflicts with targets specified via "ext[234]/xfs/btrfs/nfs".
+As an nfs example: +dracut_args --mount "192.168.1.1:/test test nfs defaults,x-initrd.mount"
+Note 1: Only one mount target is allowed using "dracut_args" globally.
+Note 2: Dracut will create <mountpoint> if it doesn't exist in kdump kernel.
+Note 3: Users should do a test first and ensure it works because kdump does
not prepare the mount and check all the validity.
.RE
diff --git a/kexec-kdump-howto.txt b/kexec-kdump-howto.txt index b4cdc22..dde95c6 100644 --- a/kexec-kdump-howto.txt +++ b/kexec-kdump-howto.txt @@ -345,6 +345,27 @@ mount the NFS mount and copy out the vmcore to your NFS server. Restart the kdump service via '/sbin/systemctl restart kdump.service' to commit this change to your kdump initrd.
+Special mount via "dracut_args"
+Kdump uses dracut to generate initramfs for second kernel. This option +allows a user to pass arguments to dracut directly.
+Users can utilize "dracut_args" to pass "--mount" to kdump, please refer +to "man dracut" for the format of "--mount" argument. If there is any +"--mount" specified via "dracut_args", kdump always uses it as the final +mount target without any validation(mounting or checking like mount options, +fs size, save path, etc), so users are expected to ensure all the correctness. +It conflicts with targets specified via "ext[234]/xfs/btrfs/nfs".
+As an nfs special mount example: +dracut_args --mount "192.168.1.1:/test test nfs defaults,x-initrd.mount"
Here we need to specify that one should strictly use "" and not '' to specify --mount argument. Or may be better to change the code so that it greps for either "--mount "" or "--mount '"
~Pratyush
+NOTE: +-Only one mount target is allowed using "dracut_args" globally. +-Dracut will create <mountpoint> if it doesn't exist in kdump kernel. +-Users should do a test first and ensure it works because kdump does
- not prepare the mount and check all the validity.
Remote system via ssh/scp
Dumping over ssh/scp requires setting up passwordless ssh keys for every
1.8.3.1 _______________________________________________ kexec mailing list kexec@lists.fedoraproject.org http://lists.fedoraproject.org/admin/lists/kexec@lists.fedoraproject.org
On 2016/05/24 at 17:42, Pratyush Anand wrote:
Hi Xunlei,
On 23/05/2016:03:06:01 PM, Xunlei Pang wrote:
Update "kexec-kdump-howto", as well as "kdump.conf" and its man page.
Signed-off-by: Xunlei Pang xlpang@redhat.com
kdump.conf | 17 +++++++++++++++++ kdump.conf.5 | 17 +++++++++++++++++ kexec-kdump-howto.txt | 21 +++++++++++++++++++++ 3 files changed, 55 insertions(+)
diff --git a/kdump.conf b/kdump.conf index 54b581d..ed20f71 100644 --- a/kdump.conf +++ b/kdump.conf @@ -133,6 +133,23 @@ # - Pass extra dracut options when rebuilding kdump # initrd. # +# Users can utilize this directive to pass "--mount" to kdump, +# please refer to "man dracut" for the format of "--mount" argument. +# If there is any "--mount" specified via "dracut_args", kdump +# always uses it as the final mount target without any validation +# (mounting or checking like mount options, fs size, save path, etc), +# so users are expected to ensure all its correctness. It conflicts +# with targets specified via "ext[234]/xfs/btrfs/nfs". +# +# As an nfs example: +# dracut_args --mount "192.168.1.1:/test test nfs defaults,x-initrd.mount" +# +# NOTE: +# -Only one mount target is allowed using "dracut_args" globally. +# -Dracut will create <mountpoint> if it doesn't exist in kdump kernel. +# -Users should do a test first and ensure it works because kdump does +# not prepare the mount and check all the validity. +# # fence_kdump_args <arg(s)> # - Command line arguments for fence_kdump_send (it can contain # all valid arguments except hosts to send notification to). diff --git a/kdump.conf.5 b/kdump.conf.5 index f1c2a2c..7b5b0ba 100644 --- a/kdump.conf.5 +++ b/kdump.conf.5 @@ -183,6 +183,23 @@ to try dumping. By default, it's set to 0, means not to try a destined failure. .RS Kdump uses dracut to generate initramfs for second kernel. This option allows a user to pass arguments to dracut directly.
+Users can utilize this directive to pass "--mount" to kdump, please refer +to "man dracut" for the format of "--mount" argument. If there is any +"--mount" specified via "dracut_args", kdump always uses it as the final +mount target without any validation(mounting or checking like mount options, +fs size, save path, etc), so users are expected to ensure all the correctness. +It conflicts with targets specified via "ext[234]/xfs/btrfs/nfs".
+As an nfs example: +dracut_args --mount "192.168.1.1:/test test nfs defaults,x-initrd.mount"
+Note 1: Only one mount target is allowed using "dracut_args" globally.
+Note 2: Dracut will create <mountpoint> if it doesn't exist in kdump kernel.
+Note 3: Users should do a test first and ensure it works because kdump does
not prepare the mount and check all the validity.
.RE
diff --git a/kexec-kdump-howto.txt b/kexec-kdump-howto.txt index b4cdc22..dde95c6 100644 --- a/kexec-kdump-howto.txt +++ b/kexec-kdump-howto.txt @@ -345,6 +345,27 @@ mount the NFS mount and copy out the vmcore to your NFS server. Restart the kdump service via '/sbin/systemctl restart kdump.service' to commit this change to your kdump initrd.
+Special mount via "dracut_args"
+Kdump uses dracut to generate initramfs for second kernel. This option +allows a user to pass arguments to dracut directly.
+Users can utilize "dracut_args" to pass "--mount" to kdump, please refer +to "man dracut" for the format of "--mount" argument. If there is any +"--mount" specified via "dracut_args", kdump always uses it as the final +mount target without any validation(mounting or checking like mount options, +fs size, save path, etc), so users are expected to ensure all the correctness. +It conflicts with targets specified via "ext[234]/xfs/btrfs/nfs".
+As an nfs special mount example: +dracut_args --mount "192.168.1.1:/test test nfs defaults,x-initrd.mount"
Here we need to specify that one should strictly use "" and not '' to specify --mount argument. Or may be better to change the code so that it greps for either "--mount "" or "--mount '"
Yeah, I prefer document it clearly to use "". Thanks for the suggestion.
Regards, Xunlei
~Pratyush
+NOTE: +-Only one mount target is allowed using "dracut_args" globally. +-Dracut will create <mountpoint> if it doesn't exist in kdump kernel. +-Users should do a test first and ensure it works because kdump does
- not prepare the mount and check all the validity.
Remote system via ssh/scp
Dumping over ssh/scp requires setting up passwordless ssh keys for every
1.8.3.1 _______________________________________________ kexec mailing list kexec@lists.fedoraproject.org http://lists.fedoraproject.org/admin/lists/kexec@lists.fedoraproject.org
Hi Xunlei,
On 23/05/2016:03:06:00 PM, Xunlei Pang wrote:
There are some complaints about nfs kdump that users must mount nfs beforehand, which may cause some overhead to nfs server. For example, there're thounsands of clients deployed with kdump diskless boot, each time the client is boot up, it will trigger kdump rebuilding so will mount nfs, thus resulting in thousands of nfs request concurrently imposed on the same nfs server.
We introduce a new way of specifying mount information via the already-existent "dracut_args" directive(so avoid adding extra directives in /etc/kdump.conf), we will skip all the filesystem mounting and checking stuff for it. So it can be used in the above-mentioned nfs scenario to avoid severe nfs server overhead.
Specifically, if there is any "--mount" information specified via "dracut_args" in /etc/kdump.conf, always use it as the final mount without any validation(mounting or checking like mount options, fs size, etc), so users are expected to ensure its correctness.
As an example: dracut_args --mount "192.168.1.1:/test test nfs defaults"
NOTE: -Only one mount information is allowed using "dracut_args". -Dracut will create <mountpoint> if it doesn't exist in kdump kernel. -Users should do a test first and ensure it works because kdump does not prepare the mount and check all the validity.
Suggested-by: Dave Young dyoung@redhat.com Signed-off-by: Xunlei Pang xlpang@redhat.com
dracut-kdump.sh | 6 +++++- dracut-module-setup.sh | 6 ++++++ kdump-lib.sh | 31 ++++++++++++++++++++++++++++++- kdumpctl | 13 ++++++++++++- mkdumprd | 5 +++++ 5 files changed, 58 insertions(+), 3 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh index 4aab205..c5bd4a6 100755 --- a/dracut-kdump.sh +++ b/dracut-kdump.sh @@ -117,7 +117,7 @@ save_vmcore_dmesg_ssh() { get_host_ip() { local _host
- if is_nfs_dump_target || is_ssh_dump_target
- if is_nfs_dump_target || is_ssh_dump_target || dracut_args_contains_nfsmount
What about for the name is_dracut_args_contain_nfsmount? It will match other nomenclature. Similarly for is_dracut_args_contain_mount.
then kdumpnic=$(getarg kdumpnic=) [ -z "$kdumpnic" ] && echo "kdump: failed to get kdumpnic!" && return 1
@@ -146,6 +146,10 @@ read_kdump_conf() # remove inline comments after the end of a directive. config_val=$(strip_comments $config_val) case "$config_opt" in
dracut_args)
config_val=$(get_target_from_dracut_args_val "$config_val")
[[ -n "$config_val" ]] && add_dump_code "dump_fs $config_val"
;; ext[234]|xfs|btrfs|minix|nfs) add_dump_code "dump_fs $config_val" ;;
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 4cd7107..a95e87b 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -433,6 +433,11 @@ kdump_install_conf() { ssh|nfs) kdump_install_net "$config_val" ;;
dracut_args)
if [[ $(get_fstype_from_dracut_args_val "$config_val") = nfs* ]]; then
kdump_install_net "$(get_target_from_dracut_args_val "$config_val")"
fi
;; kdump_pre|kdump_post|extra_bins) dracut_install $config_val ;;
@@ -684,6 +689,7 @@ install() { inst "/bin/date" "/bin/date" inst "/bin/sync" "/bin/sync" inst "/bin/cut" "/bin/cut"
- inst "/usr/bin/awk" "/usr/bin/awk" inst "/bin/head" "/bin/head" inst "/sbin/makedumpfile" "/sbin/makedumpfile" inst "/sbin/vmcore-dmesg" "/sbin/vmcore-dmesg"
diff --git a/kdump-lib.sh b/kdump-lib.sh index fc2c036..39a2d00 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -45,7 +45,8 @@ is_fs_dump_target()
is_user_configured_dump_target() {
- return $(is_ssh_dump_target || is_nfs_dump_target || is_raw_dump_target || is_fs_dump_target)
- return $(dracut_args_contains_mount || is_ssh_dump_target || is_nfs_dump_target || \
is_raw_dump_target || is_fs_dump_target)
}
strip_comments() @@ -279,3 +280,31 @@ is_hostname() fi echo $1 | grep -q "[a-zA-Z]" }
+# If "dracut_args" contains "--mount" information, use it +# directly without any check(users are expected to ensure +# its correctness). +dracut_args_contains_mount() +{
- return $(grep ^dracut_args /etc/kdump.conf | grep -q "--mount")
+}
+dracut_args_contains_nfsmount() +{
- local config_val
- config_val=$(grep ^dracut_args /etc/kdump.conf | awk -F "--mount "" '{print $2}' | cut -d' ' -f3)
- [[ $config_val = nfs* ]] && return 0
- return 1
+}
+get_fstype_from_dracut_args_val() +{
- echo $1 | awk -F "--mount "" '{print $2}' | cut -d' ' -f3
+}
+get_target_from_dracut_args_val() +{
- echo $1 | awk -F "--mount "" '{print $2}' | cut -d' ' -f1
+} diff --git a/kdumpctl b/kdumpctl index fcc9ad0..aa8232c 100755 --- a/kdumpctl +++ b/kdumpctl @@ -236,12 +236,18 @@ check_config() { local nr
- nr=$(awk 'BEGIN{cnt=0} /^raw|^ssh[[:blank:]]|^nfs|^ext[234]|^xfs|^btrfs|^minix/{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE)
nr=$(awk 'BEGIN{cnt=0} /^raw|^ssh[[:blank:]]|^nfs|^ext[234]|^xfs|^btrfs|^minix|^dracut_args .*--mount/{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE) [ $nr -gt 1 ] && { echo "More than one dump targets specified." return 1 }
nr=$(grep "^dracut_args .*--mount" $KDUMP_CONFIG_FILE | grep -o "--mount" | wc -l)
[ $nr -gt 1 ] && {
echo "More than one mount targets specified in \"dracut_args\"."
return 1
}
Probably we should also return error if kdump.conf has dracut_args and then other target like 'nfs hostip:/nfsdir'. Otherwise kdump_install_conf()->kdump_install_net() might perform the wrong settings.
while read config_opt config_val; do # remove inline comments after the end of a directive. config_val=$(strip_comments $config_val) @@ -365,6 +371,11 @@ check_dump_fs_modified() local _new_dev _new_mntpoint _new_fstype local _target _path _dracut_args
- # No need to check in case of mount target specified via "dracut_args".
- if dracut_args_contains_mount; then
return 0
- fi
- # No need to check in case of raw target. # Currently we do not check also if ssh/nfs target is specified if is_ssh_dump_target || is_nfs_dump_target || is_raw_dump_target; then
diff --git a/mkdumprd b/mkdumprd index 78afb1a..573da96 100644 --- a/mkdumprd +++ b/mkdumprd @@ -544,6 +544,11 @@ do verify_core_collector "$config_val" ;; dracut_args)
if [[ $(get_fstype_from_dracut_args_val "$config_val") = nfs* ]]; then
add_dracut_module "nfs"
# nfs may not be mounted, we need to add nfs related modules explicitly.
add_dracut_arg "--add-drivers" "nfs nfsv4"
*)fi add_dracut_arg $config_val ;;
~Pratyush
On 2016/05/24 at 16:16, Pratyush Anand wrote:
Hi Xunlei,
On 23/05/2016:03:06:00 PM, Xunlei Pang wrote:
There are some complaints about nfs kdump that users must mount nfs beforehand, which may cause some overhead to nfs server. For example, there're thounsands of clients deployed with kdump diskless boot, each time the client is boot up, it will trigger kdump rebuilding so will mount nfs, thus resulting in thousands of nfs request concurrently imposed on the same nfs server.
We introduce a new way of specifying mount information via the already-existent "dracut_args" directive(so avoid adding extra directives in /etc/kdump.conf), we will skip all the filesystem mounting and checking stuff for it. So it can be used in the above-mentioned nfs scenario to avoid severe nfs server overhead.
Specifically, if there is any "--mount" information specified via "dracut_args" in /etc/kdump.conf, always use it as the final mount without any validation(mounting or checking like mount options, fs size, etc), so users are expected to ensure its correctness.
As an example: dracut_args --mount "192.168.1.1:/test test nfs defaults"
NOTE: -Only one mount information is allowed using "dracut_args". -Dracut will create <mountpoint> if it doesn't exist in kdump kernel. -Users should do a test first and ensure it works because kdump does not prepare the mount and check all the validity.
Suggested-by: Dave Young dyoung@redhat.com Signed-off-by: Xunlei Pang xlpang@redhat.com
dracut-kdump.sh | 6 +++++- dracut-module-setup.sh | 6 ++++++ kdump-lib.sh | 31 ++++++++++++++++++++++++++++++- kdumpctl | 13 ++++++++++++- mkdumprd | 5 +++++ 5 files changed, 58 insertions(+), 3 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh index 4aab205..c5bd4a6 100755 --- a/dracut-kdump.sh +++ b/dracut-kdump.sh @@ -117,7 +117,7 @@ save_vmcore_dmesg_ssh() { get_host_ip() { local _host
- if is_nfs_dump_target || is_ssh_dump_target
- if is_nfs_dump_target || is_ssh_dump_target || dracut_args_contains_nfsmount
What about for the name is_dracut_args_contain_nfsmount? It will match other nomenclature. Similarly for is_dracut_args_contain_mount.
"contain" is a verb, using "is_" prefix is probably not improper, is "does_" prefer better?
then kdumpnic=$(getarg kdumpnic=) [ -z "$kdumpnic" ] && echo "kdump: failed to get kdumpnic!" && return 1
@@ -146,6 +146,10 @@ read_kdump_conf() # remove inline comments after the end of a directive. config_val=$(strip_comments $config_val) case "$config_opt" in
dracut_args)
config_val=$(get_target_from_dracut_args_val "$config_val")
[[ -n "$config_val" ]] && add_dump_code "dump_fs $config_val"
;; ext[234]|xfs|btrfs|minix|nfs) add_dump_code "dump_fs $config_val" ;;
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 4cd7107..a95e87b 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -433,6 +433,11 @@ kdump_install_conf() { ssh|nfs) kdump_install_net "$config_val" ;;
dracut_args)
if [[ $(get_fstype_from_dracut_args_val "$config_val") = nfs* ]]; then
kdump_install_net "$(get_target_from_dracut_args_val "$config_val")"
fi
;; kdump_pre|kdump_post|extra_bins) dracut_install $config_val ;;
@@ -684,6 +689,7 @@ install() { inst "/bin/date" "/bin/date" inst "/bin/sync" "/bin/sync" inst "/bin/cut" "/bin/cut"
- inst "/usr/bin/awk" "/usr/bin/awk" inst "/bin/head" "/bin/head" inst "/sbin/makedumpfile" "/sbin/makedumpfile" inst "/sbin/vmcore-dmesg" "/sbin/vmcore-dmesg"
diff --git a/kdump-lib.sh b/kdump-lib.sh index fc2c036..39a2d00 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -45,7 +45,8 @@ is_fs_dump_target()
is_user_configured_dump_target() {
- return $(is_ssh_dump_target || is_nfs_dump_target || is_raw_dump_target || is_fs_dump_target)
- return $(dracut_args_contains_mount || is_ssh_dump_target || is_nfs_dump_target || \
is_raw_dump_target || is_fs_dump_target)
}
strip_comments() @@ -279,3 +280,31 @@ is_hostname() fi echo $1 | grep -q "[a-zA-Z]" }
+# If "dracut_args" contains "--mount" information, use it +# directly without any check(users are expected to ensure +# its correctness). +dracut_args_contains_mount() +{
- return $(grep ^dracut_args /etc/kdump.conf | grep -q "--mount")
+}
+dracut_args_contains_nfsmount() +{
- local config_val
- config_val=$(grep ^dracut_args /etc/kdump.conf | awk -F "--mount "" '{print $2}' | cut -d' ' -f3)
- [[ $config_val = nfs* ]] && return 0
- return 1
+}
+get_fstype_from_dracut_args_val() +{
- echo $1 | awk -F "--mount "" '{print $2}' | cut -d' ' -f3
+}
+get_target_from_dracut_args_val() +{
- echo $1 | awk -F "--mount "" '{print $2}' | cut -d' ' -f1
+} diff --git a/kdumpctl b/kdumpctl index fcc9ad0..aa8232c 100755 --- a/kdumpctl +++ b/kdumpctl @@ -236,12 +236,18 @@ check_config() { local nr
- nr=$(awk 'BEGIN{cnt=0} /^raw|^ssh[[:blank:]]|^nfs|^ext[234]|^xfs|^btrfs|^minix/{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE)
nr=$(awk 'BEGIN{cnt=0} /^raw|^ssh[[:blank:]]|^nfs|^ext[234]|^xfs|^btrfs|^minix|^dracut_args .*--mount/{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE) [ $nr -gt 1 ] && { echo "More than one dump targets specified." return 1 }
nr=$(grep "^dracut_args .*--mount" $KDUMP_CONFIG_FILE | grep -o "--mount" | wc -l)
[ $nr -gt 1 ] && {
echo "More than one mount targets specified in \"dracut_args\"."
return 1
}
Probably we should also return error if kdump.conf has dracut_args and then other target like 'nfs hostip:/nfsdir'. Otherwise kdump_install_conf()->kdump_install_net() might perform the wrong settings.
The check above should guarantee what you concerned.
Regards, Xunlei
while read config_opt config_val; do # remove inline comments after the end of a directive. config_val=$(strip_comments $config_val) @@ -365,6 +371,11 @@ check_dump_fs_modified() local _new_dev _new_mntpoint _new_fstype local _target _path _dracut_args
- # No need to check in case of mount target specified via "dracut_args".
- if dracut_args_contains_mount; then
return 0
- fi
- # No need to check in case of raw target. # Currently we do not check also if ssh/nfs target is specified if is_ssh_dump_target || is_nfs_dump_target || is_raw_dump_target; then
diff --git a/mkdumprd b/mkdumprd index 78afb1a..573da96 100644 --- a/mkdumprd +++ b/mkdumprd @@ -544,6 +544,11 @@ do verify_core_collector "$config_val" ;; dracut_args)
if [[ $(get_fstype_from_dracut_args_val "$config_val") = nfs* ]]; then
add_dracut_module "nfs"
# nfs may not be mounted, we need to add nfs related modules explicitly.
add_dracut_arg "--add-drivers" "nfs nfsv4"
*)fi add_dracut_arg $config_val ;;
~Pratyush
Hi,
{ local _host
- if is_nfs_dump_target || is_ssh_dump_target
- if is_nfs_dump_target || is_ssh_dump_target || dracut_args_contains_nfsmount
What about for the name is_dracut_args_contain_nfsmount? It will match other nomenclature. Similarly for is_dracut_args_contain_mount.
"contain" is a verb, using "is_" prefix is probably not improper, is "does_" prefer better?
Or just add the check in is_nfs_dump_target function itself in kdump-lib.sh
Thanks Dave
On 2016/05/24 at 16:41, Dave Young wrote:
Hi,
{ local _host
- if is_nfs_dump_target || is_ssh_dump_target
- if is_nfs_dump_target || is_ssh_dump_target || dracut_args_contains_nfsmount
What about for the name is_dracut_args_contain_nfsmount? It will match other nomenclature. Similarly for is_dracut_args_contain_mount.
"contain" is a verb, using "is_" prefix is probably not improper, is "does_" prefer better?
Or just add the check in is_nfs_dump_target function itself in kdump-lib.sh
For "dracut_args_contains_nfsmount", I think it's nice. But we still need to have "dracut_args_contains_mount".
Regards, Xunlei
Thanks Dave
On 24/05/2016:04:36:36 PM, Xunlei Pang wrote:
On 2016/05/24 at 16:16, Pratyush Anand wrote:
Hi Xunlei,
On 23/05/2016:03:06:00 PM, Xunlei Pang wrote:
There are some complaints about nfs kdump that users must mount nfs beforehand, which may cause some overhead to nfs server. For example, there're thounsands of clients deployed with kdump diskless boot, each time the client is boot up, it will trigger kdump rebuilding so will mount nfs, thus resulting in thousands of nfs request concurrently imposed on the same nfs server.
We introduce a new way of specifying mount information via the already-existent "dracut_args" directive(so avoid adding extra directives in /etc/kdump.conf), we will skip all the filesystem mounting and checking stuff for it. So it can be used in the above-mentioned nfs scenario to avoid severe nfs server overhead.
Specifically, if there is any "--mount" information specified via "dracut_args" in /etc/kdump.conf, always use it as the final mount without any validation(mounting or checking like mount options, fs size, etc), so users are expected to ensure its correctness.
As an example: dracut_args --mount "192.168.1.1:/test test nfs defaults"
NOTE: -Only one mount information is allowed using "dracut_args". -Dracut will create <mountpoint> if it doesn't exist in kdump kernel. -Users should do a test first and ensure it works because kdump does not prepare the mount and check all the validity.
Suggested-by: Dave Young dyoung@redhat.com Signed-off-by: Xunlei Pang xlpang@redhat.com
dracut-kdump.sh | 6 +++++- dracut-module-setup.sh | 6 ++++++ kdump-lib.sh | 31 ++++++++++++++++++++++++++++++- kdumpctl | 13 ++++++++++++- mkdumprd | 5 +++++ 5 files changed, 58 insertions(+), 3 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh index 4aab205..c5bd4a6 100755 --- a/dracut-kdump.sh +++ b/dracut-kdump.sh @@ -117,7 +117,7 @@ save_vmcore_dmesg_ssh() { get_host_ip() { local _host
- if is_nfs_dump_target || is_ssh_dump_target
- if is_nfs_dump_target || is_ssh_dump_target || dracut_args_contains_nfsmount
What about for the name is_dracut_args_contain_nfsmount? It will match other nomenclature. Similarly for is_dracut_args_contain_mount.
"contain" is a verb, using "is_" prefix is probably not improper, is "does_" prefer better?
OK.. I am fine with "does_".
then kdumpnic=$(getarg kdumpnic=) [ -z "$kdumpnic" ] && echo "kdump: failed to get kdumpnic!" && return 1
@@ -146,6 +146,10 @@ read_kdump_conf() # remove inline comments after the end of a directive. config_val=$(strip_comments $config_val) case "$config_opt" in
dracut_args)
config_val=$(get_target_from_dracut_args_val "$config_val")
[[ -n "$config_val" ]] && add_dump_code "dump_fs $config_val"
;; ext[234]|xfs|btrfs|minix|nfs) add_dump_code "dump_fs $config_val" ;;
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 4cd7107..a95e87b 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -433,6 +433,11 @@ kdump_install_conf() { ssh|nfs) kdump_install_net "$config_val" ;;
dracut_args)
if [[ $(get_fstype_from_dracut_args_val "$config_val") = nfs* ]]; then
kdump_install_net "$(get_target_from_dracut_args_val "$config_val")"
fi
;; kdump_pre|kdump_post|extra_bins) dracut_install $config_val ;;
@@ -684,6 +689,7 @@ install() { inst "/bin/date" "/bin/date" inst "/bin/sync" "/bin/sync" inst "/bin/cut" "/bin/cut"
- inst "/usr/bin/awk" "/usr/bin/awk" inst "/bin/head" "/bin/head" inst "/sbin/makedumpfile" "/sbin/makedumpfile" inst "/sbin/vmcore-dmesg" "/sbin/vmcore-dmesg"
diff --git a/kdump-lib.sh b/kdump-lib.sh index fc2c036..39a2d00 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -45,7 +45,8 @@ is_fs_dump_target()
is_user_configured_dump_target() {
- return $(is_ssh_dump_target || is_nfs_dump_target || is_raw_dump_target || is_fs_dump_target)
- return $(dracut_args_contains_mount || is_ssh_dump_target || is_nfs_dump_target || \
is_raw_dump_target || is_fs_dump_target)
}
strip_comments() @@ -279,3 +280,31 @@ is_hostname() fi echo $1 | grep -q "[a-zA-Z]" }
+# If "dracut_args" contains "--mount" information, use it +# directly without any check(users are expected to ensure +# its correctness). +dracut_args_contains_mount() +{
- return $(grep ^dracut_args /etc/kdump.conf | grep -q "--mount")
+}
+dracut_args_contains_nfsmount() +{
- local config_val
- config_val=$(grep ^dracut_args /etc/kdump.conf | awk -F "--mount "" '{print $2}' | cut -d' ' -f3)
- [[ $config_val = nfs* ]] && return 0
- return 1
+}
+get_fstype_from_dracut_args_val() +{
- echo $1 | awk -F "--mount "" '{print $2}' | cut -d' ' -f3
+}
+get_target_from_dracut_args_val() +{
- echo $1 | awk -F "--mount "" '{print $2}' | cut -d' ' -f1
+} diff --git a/kdumpctl b/kdumpctl index fcc9ad0..aa8232c 100755 --- a/kdumpctl +++ b/kdumpctl @@ -236,12 +236,18 @@ check_config() { local nr
- nr=$(awk 'BEGIN{cnt=0} /^raw|^ssh[[:blank:]]|^nfs|^ext[234]|^xfs|^btrfs|^minix/{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE)
- nr=$(awk 'BEGIN{cnt=0} /^raw|^ssh[[:blank:]]|^nfs|^ext[234]|^xfs|^btrfs|^minix|^dracut_args .*--mount/{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE) [ $nr -gt 1 ] && { echo "More than one dump targets specified." return 1 }
Yes, you are right..here itself more than one target including dracut_args will be detected.
- nr=$(grep "^dracut_args .*--mount" $KDUMP_CONFIG_FILE | grep -o "--mount" | wc -l)
- [ $nr -gt 1 ] && {
echo "More than one mount targets specified in \"dracut_args\"."
return 1
- }
Probably we should also return error if kdump.conf has dracut_args and then other target like 'nfs hostip:/nfsdir'. Otherwise kdump_install_conf()->kdump_install_net() might perform the wrong settings.
The check above should guarantee what you concerned.
Regards, Xunlei
while read config_opt config_val; do # remove inline comments after the end of a directive. config_val=$(strip_comments $config_val) @@ -365,6 +371,11 @@ check_dump_fs_modified() local _new_dev _new_mntpoint _new_fstype local _target _path _dracut_args
- # No need to check in case of mount target specified via "dracut_args".
- if dracut_args_contains_mount; then
return 0
- fi
- # No need to check in case of raw target. # Currently we do not check also if ssh/nfs target is specified if is_ssh_dump_target || is_nfs_dump_target || is_raw_dump_target; then
diff --git a/mkdumprd b/mkdumprd index 78afb1a..573da96 100644 --- a/mkdumprd +++ b/mkdumprd @@ -544,6 +544,11 @@ do verify_core_collector "$config_val" ;; dracut_args)
if [[ $(get_fstype_from_dracut_args_val "$config_val") = nfs* ]]; then
add_dracut_module "nfs"
# nfs may not be mounted, we need to add nfs related modules explicitly.
add_dracut_arg "--add-drivers" "nfs nfsv4"
*)fi add_dracut_arg $config_val ;;
~Pratyush
Hi, Xunlei
On 05/23/16 at 03:06pm, Xunlei Pang wrote:
There are some complaints about nfs kdump that users must mount nfs beforehand, which may cause some overhead to nfs server. For example, there're thounsands of clients deployed with kdump diskless boot, each time the client is boot up, it will trigger kdump rebuilding so will mount nfs, thus resulting in thousands of nfs request concurrently imposed on the same nfs server.
We introduce a new way of specifying mount information via the already-existent "dracut_args" directive(so avoid adding extra directives in /etc/kdump.conf), we will skip all the filesystem mounting and checking stuff for it. So it can be used in the above-mentioned nfs scenario to avoid severe nfs server overhead.
Specifically, if there is any "--mount" information specified via "dracut_args" in /etc/kdump.conf, always use it as the final mount without any validation(mounting or checking like mount options, fs size, etc), so users are expected to ensure its correctness.
As an example: dracut_args --mount "192.168.1.1:/test test nfs defaults"
NOTE: -Only one mount information is allowed using "dracut_args". -Dracut will create <mountpoint> if it doesn't exist in kdump kernel. -Users should do a test first and ensure it works because kdump does not prepare the mount and check all the validity.
Suggested-by: Dave Young dyoung@redhat.com Signed-off-by: Xunlei Pang xlpang@redhat.com
dracut-kdump.sh | 6 +++++- dracut-module-setup.sh | 6 ++++++ kdump-lib.sh | 31 ++++++++++++++++++++++++++++++- kdumpctl | 13 ++++++++++++- mkdumprd | 5 +++++ 5 files changed, 58 insertions(+), 3 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh index 4aab205..c5bd4a6 100755 --- a/dracut-kdump.sh +++ b/dracut-kdump.sh @@ -117,7 +117,7 @@ save_vmcore_dmesg_ssh() { get_host_ip() { local _host
- if is_nfs_dump_target || is_ssh_dump_target
- if is_nfs_dump_target || is_ssh_dump_target || dracut_args_contains_nfsmount then kdumpnic=$(getarg kdumpnic=) [ -z "$kdumpnic" ] && echo "kdump: failed to get kdumpnic!" && return 1
@@ -146,6 +146,10 @@ read_kdump_conf() # remove inline comments after the end of a directive. config_val=$(strip_comments $config_val) case "$config_opt" in
dracut_args)
config_val=$(get_target_from_dracut_args_val "$config_val")
[[ -n "$config_val" ]] && add_dump_code "dump_fs $config_val"
;; ext[234]|xfs|btrfs|minix|nfs) add_dump_code "dump_fs $config_val" ;;
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 4cd7107..a95e87b 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -433,6 +433,11 @@ kdump_install_conf() { ssh|nfs) kdump_install_net "$config_val" ;;
dracut_args)
if [[ $(get_fstype_from_dracut_args_val "$config_val") = nfs* ]]; then
kdump_install_net "$(get_target_from_dracut_args_val "$config_val")"
fi
;; kdump_pre|kdump_post|extra_bins) dracut_install $config_val ;;
@@ -684,6 +689,7 @@ install() { inst "/bin/date" "/bin/date" inst "/bin/sync" "/bin/sync" inst "/bin/cut" "/bin/cut"
- inst "/usr/bin/awk" "/usr/bin/awk"
Can we avoid installing extra tools like awk, if it is for getting the fs type from fstab line, we can do similar thing as dracut modules.d/95fstab-sys/mount-sys.sh: read _dev _mp _fs _opts < $1 Or using cut: echo $1|tr -s [:blank:]|cut -d' ' -f3
Suppose $a is the line with --mount in /etc/kdump.conf _fstab=$(echo ${a#*--mount})
inst "/bin/head" "/bin/head" inst "/sbin/makedumpfile" "/sbin/makedumpfile" inst "/sbin/vmcore-dmesg" "/sbin/vmcore-dmesg"
diff --git a/kdump-lib.sh b/kdump-lib.sh index fc2c036..39a2d00 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -45,7 +45,8 @@ is_fs_dump_target()
is_user_configured_dump_target() {
- return $(is_ssh_dump_target || is_nfs_dump_target || is_raw_dump_target || is_fs_dump_target)
- return $(dracut_args_contains_mount || is_ssh_dump_target || is_nfs_dump_target || \
is_raw_dump_target || is_fs_dump_target)
}
strip_comments() @@ -279,3 +280,31 @@ is_hostname() fi echo $1 | grep -q "[a-zA-Z]" }
+# If "dracut_args" contains "--mount" information, use it +# directly without any check(users are expected to ensure +# its correctness). +dracut_args_contains_mount() +{
- return $(grep ^dracut_args /etc/kdump.conf | grep -q "--mount")
+}
+dracut_args_contains_nfsmount() +{
- local config_val
- config_val=$(grep ^dracut_args /etc/kdump.conf | awk -F "--mount "" '{print $2}' | cut -d' ' -f3)
- [[ $config_val = nfs* ]] && return 0
- return 1
+}
+get_fstype_from_dracut_args_val() +{
- echo $1 | awk -F "--mount "" '{print $2}' | cut -d' ' -f3
+}
+get_target_from_dracut_args_val() +{
- echo $1 | awk -F "--mount "" '{print $2}' | cut -d' ' -f1
+} diff --git a/kdumpctl b/kdumpctl index fcc9ad0..aa8232c 100755 --- a/kdumpctl +++ b/kdumpctl @@ -236,12 +236,18 @@ check_config() { local nr
- nr=$(awk 'BEGIN{cnt=0} /^raw|^ssh[[:blank:]]|^nfs|^ext[234]|^xfs|^btrfs|^minix/{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE)
nr=$(awk 'BEGIN{cnt=0} /^raw|^ssh[[:blank:]]|^nfs|^ext[234]|^xfs|^btrfs|^minix|^dracut_args .*--mount/{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE) [ $nr -gt 1 ] && { echo "More than one dump targets specified." return 1 }
nr=$(grep "^dracut_args .*--mount" $KDUMP_CONFIG_FILE | grep -o "--mount" | wc -l)
[ $nr -gt 1 ] && {
echo "More than one mount targets specified in \"dracut_args\"."
return 1
}
while read config_opt config_val; do # remove inline comments after the end of a directive. config_val=$(strip_comments $config_val)
@@ -365,6 +371,11 @@ check_dump_fs_modified() local _new_dev _new_mntpoint _new_fstype local _target _path _dracut_args
- # No need to check in case of mount target specified via "dracut_args".
- if dracut_args_contains_mount; then
return 0
- fi
- # No need to check in case of raw target. # Currently we do not check also if ssh/nfs target is specified if is_ssh_dump_target || is_nfs_dump_target || is_raw_dump_target; then
diff --git a/mkdumprd b/mkdumprd index 78afb1a..573da96 100644 --- a/mkdumprd +++ b/mkdumprd @@ -544,6 +544,11 @@ do verify_core_collector "$config_val" ;; dracut_args)
if [[ $(get_fstype_from_dracut_args_val "$config_val") = nfs* ]]; then
is_nfs_in_dracut_args sounds better?
like get_fstype_from_dracut_args_vgl seems too long, how about something like: get_dracut_args_fs; get_dracut_args_target; ...
add_dracut_module "nfs"
# nfs may not be mounted, we need to add nfs related modules explicitly.
add_dracut_arg "--add-drivers" "nfs nfsv4"
*)fi add_dracut_arg $config_val ;;
-- 1.8.3.1
Thanks Dave
On 2016/05/24 at 17:34, Dave Young wrote:
Hi, Xunlei
On 05/23/16 at 03:06pm, Xunlei Pang wrote:
There are some complaints about nfs kdump that users must mount nfs beforehand, which may cause some overhead to nfs server. For example, there're thounsands of clients deployed with kdump diskless boot, each time the client is boot up, it will trigger kdump rebuilding so will mount nfs, thus resulting in thousands of nfs request concurrently imposed on the same nfs server.
We introduce a new way of specifying mount information via the already-existent "dracut_args" directive(so avoid adding extra directives in /etc/kdump.conf), we will skip all the filesystem mounting and checking stuff for it. So it can be used in the above-mentioned nfs scenario to avoid severe nfs server overhead.
Specifically, if there is any "--mount" information specified via "dracut_args" in /etc/kdump.conf, always use it as the final mount without any validation(mounting or checking like mount options, fs size, etc), so users are expected to ensure its correctness.
As an example: dracut_args --mount "192.168.1.1:/test test nfs defaults"
NOTE: -Only one mount information is allowed using "dracut_args". -Dracut will create <mountpoint> if it doesn't exist in kdump kernel. -Users should do a test first and ensure it works because kdump does not prepare the mount and check all the validity.
Suggested-by: Dave Young dyoung@redhat.com Signed-off-by: Xunlei Pang xlpang@redhat.com
dracut-kdump.sh | 6 +++++- dracut-module-setup.sh | 6 ++++++ kdump-lib.sh | 31 ++++++++++++++++++++++++++++++- kdumpctl | 13 ++++++++++++- mkdumprd | 5 +++++ 5 files changed, 58 insertions(+), 3 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh index 4aab205..c5bd4a6 100755 --- a/dracut-kdump.sh +++ b/dracut-kdump.sh @@ -117,7 +117,7 @@ save_vmcore_dmesg_ssh() { get_host_ip() { local _host
- if is_nfs_dump_target || is_ssh_dump_target
- if is_nfs_dump_target || is_ssh_dump_target || dracut_args_contains_nfsmount then kdumpnic=$(getarg kdumpnic=) [ -z "$kdumpnic" ] && echo "kdump: failed to get kdumpnic!" && return 1
@@ -146,6 +146,10 @@ read_kdump_conf() # remove inline comments after the end of a directive. config_val=$(strip_comments $config_val) case "$config_opt" in
dracut_args)
config_val=$(get_target_from_dracut_args_val "$config_val")
[[ -n "$config_val" ]] && add_dump_code "dump_fs $config_val"
;; ext[234]|xfs|btrfs|minix|nfs) add_dump_code "dump_fs $config_val" ;;
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 4cd7107..a95e87b 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -433,6 +433,11 @@ kdump_install_conf() { ssh|nfs) kdump_install_net "$config_val" ;;
dracut_args)
if [[ $(get_fstype_from_dracut_args_val "$config_val") = nfs* ]]; then
kdump_install_net "$(get_target_from_dracut_args_val "$config_val")"
fi
;; kdump_pre|kdump_post|extra_bins) dracut_install $config_val ;;
@@ -684,6 +689,7 @@ install() { inst "/bin/date" "/bin/date" inst "/bin/sync" "/bin/sync" inst "/bin/cut" "/bin/cut"
- inst "/usr/bin/awk" "/usr/bin/awk"
Can we avoid installing extra tools like awk, if it is for getting the fs type from fstab line, we can do similar thing as dracut modules.d/95fstab-sys/mount-sys.sh: read _dev _mp _fs _opts < $1 Or using cut: echo $1|tr -s [:blank:]|cut -d' ' -f3
Suppose $a is the line with --mount in /etc/kdump.conf _fstab=$(echo ${a#*--mount})
Sure
inst "/bin/head" "/bin/head" inst "/sbin/makedumpfile" "/sbin/makedumpfile" inst "/sbin/vmcore-dmesg" "/sbin/vmcore-dmesg"
diff --git a/kdump-lib.sh b/kdump-lib.sh index fc2c036..39a2d00 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -45,7 +45,8 @@ is_fs_dump_target()
is_user_configured_dump_target() {
- return $(is_ssh_dump_target || is_nfs_dump_target || is_raw_dump_target || is_fs_dump_target)
- return $(dracut_args_contains_mount || is_ssh_dump_target || is_nfs_dump_target || \
is_raw_dump_target || is_fs_dump_target)
}
strip_comments() @@ -279,3 +280,31 @@ is_hostname() fi echo $1 | grep -q "[a-zA-Z]" }
+# If "dracut_args" contains "--mount" information, use it +# directly without any check(users are expected to ensure +# its correctness). +dracut_args_contains_mount() +{
- return $(grep ^dracut_args /etc/kdump.conf | grep -q "--mount")
+}
+dracut_args_contains_nfsmount() +{
- local config_val
- config_val=$(grep ^dracut_args /etc/kdump.conf | awk -F "--mount "" '{print $2}' | cut -d' ' -f3)
- [[ $config_val = nfs* ]] && return 0
- return 1
+}
+get_fstype_from_dracut_args_val() +{
- echo $1 | awk -F "--mount "" '{print $2}' | cut -d' ' -f3
+}
+get_target_from_dracut_args_val() +{
- echo $1 | awk -F "--mount "" '{print $2}' | cut -d' ' -f1
+} diff --git a/kdumpctl b/kdumpctl index fcc9ad0..aa8232c 100755 --- a/kdumpctl +++ b/kdumpctl @@ -236,12 +236,18 @@ check_config() { local nr
- nr=$(awk 'BEGIN{cnt=0} /^raw|^ssh[[:blank:]]|^nfs|^ext[234]|^xfs|^btrfs|^minix/{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE)
nr=$(awk 'BEGIN{cnt=0} /^raw|^ssh[[:blank:]]|^nfs|^ext[234]|^xfs|^btrfs|^minix|^dracut_args .*--mount/{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE) [ $nr -gt 1 ] && { echo "More than one dump targets specified." return 1 }
nr=$(grep "^dracut_args .*--mount" $KDUMP_CONFIG_FILE | grep -o "--mount" | wc -l)
[ $nr -gt 1 ] && {
echo "More than one mount targets specified in \"dracut_args\"."
return 1
}
while read config_opt config_val; do # remove inline comments after the end of a directive. config_val=$(strip_comments $config_val)
@@ -365,6 +371,11 @@ check_dump_fs_modified() local _new_dev _new_mntpoint _new_fstype local _target _path _dracut_args
- # No need to check in case of mount target specified via "dracut_args".
- if dracut_args_contains_mount; then
return 0
- fi
- # No need to check in case of raw target. # Currently we do not check also if ssh/nfs target is specified if is_ssh_dump_target || is_nfs_dump_target || is_raw_dump_target; then
diff --git a/mkdumprd b/mkdumprd index 78afb1a..573da96 100644 --- a/mkdumprd +++ b/mkdumprd @@ -544,6 +544,11 @@ do verify_core_collector "$config_val" ;; dracut_args)
if [[ $(get_fstype_from_dracut_args_val "$config_val") = nfs* ]]; then
is_nfs_in_dracut_args sounds better?
sounds good.
like get_fstype_from_dracut_args_vgl seems too long, how about something like: get_dracut_args_fs; get_dracut_args_target; ...
I'm fine with this.
Regards, Xunlei
add_dracut_module "nfs"
# nfs may not be mounted, we need to add nfs related modules explicitly.
add_dracut_arg "--add-drivers" "nfs nfsv4"
*)fi add_dracut_arg $config_val ;;
-- 1.8.3.1
Thanks Dave