mkdumprd: prompt the user to install nfs-utils when mounting NFS fs failed
upstream: fedora
resolves: bz2003832
conflict: none
commit e5a745ce77
Author: Coiby Xu <coxu@redhat.com>
Date:   Sat Feb 20 11:55:52 2021 +0800
    mkdumprd: prompt the user to install nfs-utils when mounting NFS fs failed
    When nfs-utils is not installed, mounting as NFS fs would fail.
    Currently, the error message is not user-friendly,
        mount: /tmp/mkdumprd.HyPGpS/target: bad option; for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.<type> helper program.
        kdump: Failed to mount on xxx for kdump preflight check.
        kdump: mkdumprd: failed to make kdump initrd
    Prompt the user to install nfs-utilsa in the error message,
        kdump: Failed to mount on xxx for kdump preflight check. Please make sure nfs-utils has been installed.
    Signed-off-by: Coiby Xu <coxu@redhat.com>
    Acked-by: Kairui Song <kasong@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
			
			
This commit is contained in:
		
							parent
							
								
									16c2821171
								
							
						
					
					
						commit
						b9cefb4161
					
				
							
								
								
									
										24
									
								
								mkdumprd
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								mkdumprd
									
									
									
									
									
								
							| @ -183,6 +183,26 @@ check_save_path_fs() | |||||||
|     fi |     fi | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | mount_failure() | ||||||
|  | { | ||||||
|  |     local _target=$1 | ||||||
|  |     local _mnt=$2 | ||||||
|  |     local _fstype=$3 | ||||||
|  |     local msg="Failed to mount $_target" | ||||||
|  | 
 | ||||||
|  |     if [ -n "$_mnt" ]; then | ||||||
|  |         msg="$msg on $_mnt" | ||||||
|  |     fi | ||||||
|  | 
 | ||||||
|  |     msg="$msg for kdump preflight check." | ||||||
|  | 
 | ||||||
|  |     if [[ $_fstype = "nfs" ]]; then | ||||||
|  |         msg="$msg Please make sure nfs-utils has been installed." | ||||||
|  |     fi | ||||||
|  | 
 | ||||||
|  |     perror_exit "$msg" | ||||||
|  | } | ||||||
|  | 
 | ||||||
| check_user_configured_target() | check_user_configured_target() | ||||||
| { | { | ||||||
|     local _target=$1 _cfg_fs_type=$2 _mounted |     local _target=$1 _cfg_fs_type=$2 _mounted | ||||||
| @ -208,7 +228,7 @@ check_user_configured_target() | |||||||
|         if ! is_mounted "$_mnt"; then |         if ! is_mounted "$_mnt"; then | ||||||
|             if [[ $_opt  = *",noauto"* ]]; then |             if [[ $_opt  = *",noauto"* ]]; then | ||||||
|                 mount $_mnt |                 mount $_mnt | ||||||
|                 [ $? -ne 0 ] && perror_exit "Failed to mount $_target on $_mnt for kdump preflight check." |                 [ $? -ne 0 ] && mount_failure "$_target" "$_mnt" "$_fstype" | ||||||
|                 _mounted=$_mnt |                 _mounted=$_mnt | ||||||
|             else |             else | ||||||
|                 perror_exit "Dump target \"$_target\" is neither mounted nor configured as \"noauto\"" |                 perror_exit "Dump target \"$_target\" is neither mounted nor configured as \"noauto\"" | ||||||
| @ -218,7 +238,7 @@ check_user_configured_target() | |||||||
|         _mnt=$MKDUMPRD_TMPMNT |         _mnt=$MKDUMPRD_TMPMNT | ||||||
|         mkdir -p $_mnt |         mkdir -p $_mnt | ||||||
|         mount $_target $_mnt -t $_fstype -o defaults |         mount $_target $_mnt -t $_fstype -o defaults | ||||||
|         [ $? -ne 0 ] && perror_exit "Failed to mount $_target for kdump preflight check." |         [ $? -ne 0 ] && mount_failure "$_target" "" "$_fstype" | ||||||
|         _mounted=$_mnt |         _mounted=$_mnt | ||||||
|     fi |     fi | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user