On 07/10/2017 at 03:14 PM, Baoquan He wrote:
On 07/07/17 at 03:48pm, Xunlei Pang wrote:
> -For nfs/ssh dumping, there is no need to check the root device.
> -Move get_save_path into kdump-lib.sh.
Does it mean that default dump_to_rootfs action is unavailable if
nfs/ssh target is specified?
It's only for get_block_dump_target(), as we already removed "root=X",
there is no need to get the root device if the dump target is not at root.
For dump_to_rootfs cases, it's handled after get_block_dump_target().
Regards,
Xunlei
> After this patch, get_block_dump_target() can always return the
> correct block dump target specified.
>
> Signed-off-by: Xunlei Pang <xlpang(a)redhat.com>
> ---
> v3->v4:
> -No change.
>
> kdump-lib.sh | 48 ++++++++++++++++++++++++++++++++++++------------
> kdumpctl | 10 ----------
> mkdumprd | 13 -------------
> 3 files changed, 36 insertions(+), 35 deletions(-)
>
> diff --git a/kdump-lib.sh b/kdump-lib.sh
> index 8ebad70..3cf7af5 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,18 +82,21 @@ 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
>
> - if is_ssh_dump_target || is_nfs_dump_target; then
> - return
> - 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 +108,33 @@ get_root_fs_device()
> return
> }
>
> +get_save_path()
> +{
> + local _save_path=$(grep "^path" /etc/kdump.conf|awk '{print
$2}')
> + if [ -z "$_save_path" ]; then
> + _save_path=$DEFAULT_PATH
> + fi
> +
> + echo $_save_path
> +}
> +
> +get_block_dump_target()
> +{
> + local _target _path
> +
> + if is_ssh_dump_target || is_nfs_dump_target; then
> + return
> + fi
> +
> + _target=$(get_user_configured_dump_disk)
> + [ -n "$_target" ] && echo $(to_dev_name $_target) &&
return
> +
> + # Get block device name from local save path
> + _path=$(get_save_path)
> + _target=$(get_target_from_path $_path)
> + [ -b "$_target" ] && echo $(to_dev_name $_target)
> +}
> +
> # findmnt uses the option "-v, --nofsroot" to exclusive the [/dir]
> # in the SOURCE column for bind-mounts, then if $_mntpoint equals to
> # $_mntpoint_nofsroot, the mountpoint is not bind mounted directory.
> diff --git a/kdumpctl b/kdumpctl
> index e440bbb..0e53793 100755
> --- a/kdumpctl
> +++ b/kdumpctl
> @@ -974,16 +974,6 @@ save_raw()
> return 0
> }
>
> -get_save_path()
> -{
> - local _save_path=$(grep "^path" /etc/kdump.conf|awk '{print
$2}')
> - if [ -z "$_save_path" ]; then
> - _save_path="/var/crash"
> - fi
> -
> - echo $_save_path
> -}
> -
> is_dump_target_configured()
> {
> local _target
> diff --git a/mkdumprd b/mkdumprd
> index 5a25853..45b185a 100644
> --- a/mkdumprd
> +++ b/mkdumprd
> @@ -250,19 +250,6 @@ add_mount() {
> add_dracut_mount "$_mnt"
> }
>
> -get_block_dump_target()
> -{
> - local _target
> -
> -
> - _target=$(get_user_configured_dump_disk)
> - [ -n "$_target" ] && echo $(to_dev_name $_target) &&
return
> -
> - #get rootfs device name
> - _target=$(get_root_fs_device)
> - [ -b "$_target" ] && echo $(to_dev_name $_target)
> -}
> -
> #handle the case user does not specify the dump target explicitly
> handle_default_dump_target()
> {
> --
> 1.8.3.1
> _______________________________________________
> kexec mailing list -- kexec(a)lists.fedoraproject.org
> To unsubscribe send an email to kexec-leave(a)lists.fedoraproject.org