user need make sure "path" on mounted fs has been created
kdump need create the dir specified in "path" formerly if it does not exist. Now change the behavior to be that ueser takes charge of the "path", make sure "path" has been created, especially when separate disk is mounted on this "path". Also introduce 2 helper functions to help check the existence of path. Signed-off-by: Baoquan He <bhe@redhat.com> Acked-by: Vivek Goyal <vgoyal@redhat.com>
This commit is contained in:
parent
b9185c78ee
commit
b2429dbd3d
26
kdump-lib.sh
26
kdump-lib.sh
@ -116,3 +116,29 @@ get_option_value() {
|
||||
echo $(strip_comments `grep ^$1 /etc/kdump.conf | tail -1 | cut -d\ -f2-`)
|
||||
}
|
||||
|
||||
#This function compose a absolute path with the mount
|
||||
#point and the relative $SAVE_PATH.
|
||||
#target is passed in as argument, could be UUID, LABEL,
|
||||
#block device or even nfs server export of the form of
|
||||
#"my.server.com:/tmp/export"?
|
||||
#And possibly this could be used for both default case
|
||||
#as well as when dump taret is specified. When dump
|
||||
#target is not specified, then $target would be null.
|
||||
make_absolute_save_path()
|
||||
{
|
||||
local _target=$1
|
||||
local _mnt
|
||||
|
||||
[ -n $_target ] && _mnt=$(get_mntpoint_from_target $1)
|
||||
echo "${_mnt}/$SAVE_PATH"
|
||||
}
|
||||
|
||||
check_save_path_fs()
|
||||
{
|
||||
local _path=$1
|
||||
|
||||
if [ ! -d $_path ]; then
|
||||
perror_exit "Dump path $_path does not exist."
|
||||
fi
|
||||
}
|
||||
|
||||
|
33
mkdumprd
33
mkdumprd
@ -173,37 +173,6 @@ mkdir_save_path_ssh()
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
#mkdir if save path does not exist on dump target filesystem
|
||||
#$1=dump target
|
||||
#caller should ensure $1 is mounted
|
||||
mkdir_save_path_fs() {
|
||||
local _mnt=$(to_mount_point $1)
|
||||
local _remount="no"
|
||||
local _ret
|
||||
|
||||
[ ! -d ${_mnt}/$SAVE_PATH ] && {
|
||||
if is_readonly_mount $1; then
|
||||
echo "Mounting $1 as read-write for creating dump directory.."
|
||||
mount -o remount,rw $1 || {
|
||||
perror_exit "Mounting $1 as read-write failed."
|
||||
}
|
||||
_remount="yes"
|
||||
fi
|
||||
mkdir -p ${_mnt}/$SAVE_PATH
|
||||
_ret=$?
|
||||
[ "$_remount" = "yes" ] && {
|
||||
echo "Remounting $1 as read-only."
|
||||
mount -o remount,ro $1 || {
|
||||
perror_exit "Remounting $1 as read-only failed."
|
||||
}
|
||||
}
|
||||
[ $_ret -ne 0 ] && {
|
||||
perror_exit "Creating ${_mnt}/$SAVE_PATH failed."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Function: get_fs_size
|
||||
#$1=dump target
|
||||
get_fs_size() {
|
||||
@ -538,7 +507,7 @@ do
|
||||
add_dracut_module "nfs"
|
||||
fi
|
||||
add_mount "$config_val"
|
||||
mkdir_save_path_fs $config_val
|
||||
check_save_path_fs $(make_absolute_save_path $config_val)
|
||||
check_size fs $config_val
|
||||
;;
|
||||
raw)
|
||||
|
Loading…
Reference in New Issue
Block a user