On 03/12/14 at 10:37am, Vivek Goyal wrote:
On Wed, Mar 12, 2014 at 05:59:28PM +0800, Baoquan He wrote:
> If default target is a separate disk, the related information need be
> stored in /etc/kdump.conf of kdump initramfs. This includes the disk
> info which will help to deduce the dump_code and path which the vmcore
> will be written into.
>
> Signed-off-by: Baoquan He <bhe(a)redhat.com>
> ---
> dracut-module-setup.sh | 37 +++++++++++++++++++++++++++++++++++++
> 1 file changed, 37 insertions(+)
>
> diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
> index bdadf7c..ce6f94a 100755
> --- a/dracut-module-setup.sh
> +++ b/dracut-module-setup.sh
> @@ -261,6 +261,41 @@ kdump_install_net() {
> fi
> }
>
> +
> +store_default_dump_target_conf()
> +{
> + local _target
> + local _s _t
> + local _mntpoint
> + local _ret
> + local _path _save_path
> +
> + _save_path=$(grep ^path "/etc/kdump.conf"| cut -d' ' -f2)
> + [ -z "$_save_path" ] && _save_path="/var/crash"
> +
> + _target=$(get_user_configured_dump_disk)
> + [ -n "$_target" ] && return
> +
> + _target=$(get_root_fs_device)
> + if [ -b "$_target" ]; then
> + mkdir -p $_save_path
> + _ret=$?
> + if [ $_ret -ne 0 ]; then
> + perror_exit "mkdir failed on $_save_path"
> + fi
> + _mntpoint=$(df $_save_path| tail -1 | awk '{print $NF}')
> + if [ "$_mntpoint" != "/" ]; then
> + _s=$(findmnt -k -f -n -o SOURCE $_mntpoint)
> + _t=$(findmnt -k -f -n -r -o FSTYPE $_s)
> + _s=$(kdump_to_udev_name $_s)
> + echo "$_t $_s" >> /tmp/$$-kdump.conf
> +
> + _path=$(echo $_save_path | sed "s,$_mntpoint,,")
> + sed -i -e "s#$_save_path#$_path#" /tmp/$$-kdump.conf
Hi Bao,
This logic to find out default dump target and modify save_path seems
common here and in mkdumprd.
I think let us intorduce some common functions in kdump-lib.sh and reuse
the code at both the places.
It seems the logic is similar, however there are tiny difference.
Their purpose are different. I will try to abstract some common
functions, this does make code beautiful.
Baoquan
Thanks
Thanks
Vivek