mkdumprd: change for_each_block_target() to use get_kdump_targets()
Resolves: bz1451717 https://bugzilla.redhat.com/1451717 Now that we have get_kdump_targets(), use it to simplify the code. Signed-off-by: Xunlei Pang <xlpang@redhat.com> Acked-by: Dave Young <dyoung@redhat.com>
This commit is contained in:
parent
3ee00cd384
commit
9e7b64dc90
25
mkdumprd
25
mkdumprd
@ -297,20 +297,11 @@ for_each_block_target()
|
|||||||
{
|
{
|
||||||
local dev majmin
|
local dev majmin
|
||||||
|
|
||||||
#check dump target
|
for dev in $(get_kdump_targets); do
|
||||||
dev=$(get_block_dump_target)
|
[ -b "$dev" ] || continue
|
||||||
|
|
||||||
if [ -n "$dev" ]; then
|
|
||||||
majmin=$(get_maj_min $dev)
|
majmin=$(get_maj_min $dev)
|
||||||
check_block_and_slaves $1 $majmin && return 1
|
check_block_and_slaves $1 $majmin && return 1
|
||||||
fi
|
done
|
||||||
|
|
||||||
#check rootfs when default action dump_to_rootfs is set
|
|
||||||
dev=$(get_default_action_target)
|
|
||||||
if [ -n "$dev" ]; then
|
|
||||||
majmin=$(get_maj_min $dev)
|
|
||||||
check_block_and_slaves $1 $majmin && return 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -329,7 +320,7 @@ is_unresettable()
|
|||||||
resettable="$(cat $path)"
|
resettable="$(cat $path)"
|
||||||
[ $resettable -eq 0 -a "$OVERRIDE_RESETTABLE" -eq 0 ] && {
|
[ $resettable -eq 0 -a "$OVERRIDE_RESETTABLE" -eq 0 ] && {
|
||||||
local device=$(udevadm info --query=all --path=/sys/dev/block/$1 | awk -F= '/DEVNAME/{print $2}')
|
local device=$(udevadm info --query=all --path=/sys/dev/block/$1 | awk -F= '/DEVNAME/{print $2}')
|
||||||
echo "Device $device is unresettable"
|
echo "Error: Can not save vmcore because device $device is unresettable"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
@ -350,14 +341,6 @@ check_resettable()
|
|||||||
|
|
||||||
[ $_ret -eq 0 ] && return
|
[ $_ret -eq 0 ] && return
|
||||||
|
|
||||||
if [ $_ret -eq 1 ]; then
|
|
||||||
_target=$(get_block_dump_target)
|
|
||||||
perror "Can not save vmcore to target device $_target . This device can not be initialized in kdump kernel as it is not resettable"
|
|
||||||
elif [ $_ret -eq 2 ]; then
|
|
||||||
_target=$(get_default_action_target)
|
|
||||||
perror "Rootfs device $_target is not resettable, can not be used as the default target, please specify a default action"
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user