Skip to content

Commit 0446a1f

Browse files
author
Lichen Liu
committed
kdump-logger.sh: Let dwarn always print "WARNING:" as prefix.
Currently, callers of dwarn() manually prepend prefixes like "WARNING:", "Warning:", or "Notice:". This leads to inconsistent output and redundant string management. Update dwarn() in kdump-logger.sh to automatically include the "WARNING:" prefix. All existing calls to dwarn() have been updated to remove manual prefixes, ensuring a consistent log format across kdumpctl, mkdumprd, and early-kdump. Resolves: https://redhat.atlassian.net/browse/RHEL-120738 Signed-off-by: Lichen Liu <lichliu@redhat.com>
1 parent a634af8 commit 0446a1f

5 files changed

Lines changed: 20 additions & 20 deletions

File tree

dracut/99earlykdump/early-kdump.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ early_kdump_load() {
3535
fi
3636

3737
if is_fadump_capable; then
38-
dwarn "WARNING: early kdump doesn't support fadump."
38+
dwarn "Early kdump doesn't support fadump."
3939
return 1
4040
fi
4141

kdump-lib.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ prepare_kexec_args()
473473
if [[ $? == 1 ]]; then
474474
found_elf_args=$(echo "$kexec_args" | grep elf32-core-headers)
475475
if [[ -n $found_elf_args ]]; then
476-
dwarn "Warning: elf32-core-headers overrides correct elf64 setting"
476+
dwarn "elf32-core-headers overrides correct elf64 setting"
477477
else
478478
kexec_args="$kexec_args --elf64-core-headers"
479479
fi

kdump-logger.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ dinfo()
363363
dwarn()
364364
{
365365
set +x
366-
dlog 2 "$@"
366+
dlog 2 "WARNING:" "$@"
367367
if [ -n "$debug" ]; then
368368
set -x
369369
fi

kdumpctl

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ rebuild_kdump_initrd()
192192
fi
193193

194194
if check_earlykdump_is_enabled; then
195-
dwarn "Tips: If early kdump is enabled, also require rebuilding the system initramfs to make the changes take effect for early kdump."
195+
dwarn "If early kdump is enabled, also require rebuilding the system initramfs to make the changes take effect for early kdump."
196196
fi
197197

198198
sync -f "$TARGET_INITRD"
@@ -274,7 +274,7 @@ backup_default_initrd()
274274

275275
dinfo "Backing up $DEFAULT_INITRD before rebuild."
276276
if ! cp "$DEFAULT_INITRD" "$DEFAULT_INITRD_BAK"; then
277-
dwarn "WARNING: failed to backup $DEFAULT_INITRD."
277+
dwarn "Failed to backup $DEFAULT_INITRD."
278278
rm -f -- "$DEFAULT_INITRD_BAK"
279279
return
280280
fi
@@ -303,7 +303,7 @@ restore_default_initrd()
303303
# If a backup initrd exists, we must be switching back from
304304
# fadump to kdump. Restore the original default initrd.
305305
if ! sha512sum --status --check "$DEFAULT_INITRD_CHECKSUM"; then
306-
dwarn "WARNING: checksum mismatch! Can't restore original initrd."
306+
dwarn "Checksum mismatch! Can't restore original initrd."
307307
return
308308
fi
309309

@@ -351,7 +351,7 @@ parse_config()
351351
;;
352352
raw)
353353
if [[ -d "/proc/device-tree/ibm,opal/dump" ]]; then
354-
dwarn "WARNING: Won't capture opalcore when 'raw' dump target is used."
354+
dwarn "Won't capture opalcore when 'raw' dump target is used."
355355
fi
356356
_set_config _fstype "$config_opt" || return 1
357357
config_opt=_target
@@ -367,12 +367,12 @@ parse_config()
367367
elif [[ -f $config_val ]]; then
368368
config_val=$(/usr/bin/readlink -m "$config_val")
369369
else
370-
dwarn "WARNING: '$config_val' doesn't exist, using default value '$DEFAULT_SSHKEY'"
370+
dwarn "'$config_val' doesn't exist, using default value '$DEFAULT_SSHKEY'"
371371
config_val=$DEFAULT_SSHKEY
372372
fi
373373
;;
374374
default)
375-
dwarn "WARNING: Option 'default' was renamed 'failure_action' and will be removed in the future."
375+
dwarn "Option 'default' was renamed 'failure_action' and will be removed in the future."
376376
dwarn "Please update $KDUMP_CONFIG_FILE to use option 'failure_action' instead."
377377
_set_config failure_action "$config_val" || return 1
378378
;;
@@ -634,7 +634,7 @@ check_fs_modified()
634634
_new_mntpoint="$(get_kdump_mntpoint_from_target "$_target")"
635635
_dracut_args=$(lsinitrd "$TARGET_INITRD" -f usr/lib/dracut/build-parameter.txt)
636636
if [[ -z $_dracut_args ]]; then
637-
dwarn "Warning: No dracut arguments found in initrd"
637+
dwarn "No dracut arguments found in initrd"
638638
return 0
639639
fi
640640

@@ -912,7 +912,7 @@ save_raw()
912912
}
913913
check_fs=$(lsblk --nodeps -npo FSTYPE "$raw_target")
914914
if [[ $(echo "$check_fs" | wc -w) -ne 0 ]]; then
915-
dwarn "Warning: Detected '$check_fs' signature on $raw_target, data loss is expected."
915+
dwarn "Detected '$check_fs' signature on $raw_target, data loss is expected."
916916
return 0
917917
fi
918918

@@ -1029,10 +1029,10 @@ fadump_bootargs_append()
10291029
output=$(cat "$FADUMP_APPEND_ARGS_SYS_NODE")
10301030
dinfo "fadump: additional parameters for capture kernel: '$output'"
10311031
else
1032-
dwarn "WARNING: failed to setup additional parameters for fadump capture kernel: '$output'"
1032+
dwarn "Failed to setup additional parameters for fadump capture kernel: '$output'"
10331033
fi
10341034
else
1035-
dwarn "WARNING: this kernel does not support passing additional parameters to fadump capture kernel."
1035+
dwarn "This kernel does not support passing additional parameters to fadump capture kernel."
10361036
fi
10371037
}
10381038

@@ -1183,7 +1183,7 @@ prepare_luks()
11831183

11841184
# Currently only x86_64 is supported
11851185
if [[ "$(uname -m)" != "x86_64" ]]; then
1186-
dwarn "Warning: Encrypted device is in dump path, which is not recommended, see kexec-kdump-howto.txt for more details."
1186+
dwarn "Encrypted device is in dump path, which is not recommended, see kexec-kdump-howto.txt for more details."
11871187
return 0
11881188
fi
11891189

@@ -2148,7 +2148,7 @@ check_vmcore_creation_status()
21482148
[[ $DEFAULT_DUMP_MODE == "kdump" ]] || return
21492149

21502150
if [[ ! -s $VMCORE_CREATION_STATUS ]]; then
2151-
dwarn "Notice: No vmcore creation test performed!"
2151+
dwarn "No vmcore creation test performed!"
21522152
return
21532153
fi
21542154

@@ -2182,10 +2182,10 @@ check_vmcore_creation_status()
21822182
dinfo "Notice: Last successful vmcore creation test on $_status_date"
21832183
;;
21842184
fail)
2185-
dwarn "Notice: Last NOT successful vmcore creation test on $_status_date"
2185+
dwarn "Last NOT successful vmcore creation test on $_status_date"
21862186
;;
21872187
manual)
2188-
dwarn "Notice: Require manual check for vmcore creation test of $_status_date"
2188+
dwarn "Require manual check for vmcore creation test of $_status_date"
21892189
;;
21902190
*)
21912191
derror "Unknown vmcore creation test status: $_status"

mkdumprd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ check_size()
192192
esac || perror_exit "Check dump target size failed"
193193

194194
if [[ $avail -lt $memtotal ]]; then
195-
dwarn "Warning: There might not be enough space to save a vmcore."
196-
dwarn " The size of $2 should be greater than $memtotal kilo bytes."
195+
dwarn "There might not be enough space to save a vmcore."
196+
dwarn "The size of $2 should be greater than $memtotal kilo bytes."
197197
fi
198198
}
199199

@@ -290,7 +290,7 @@ verify_core_collector()
290290

291291
if [[ $_cmd != "makedumpfile" ]]; then
292292
if is_raw_dump_target; then
293-
dwarn "Warning: specifying a non-makedumpfile core collector, you will have to recover the vmcore manually."
293+
dwarn "Specifying a non-makedumpfile core collector, you will have to recover the vmcore manually."
294294
fi
295295
return
296296
fi

0 commit comments

Comments
 (0)