Ccing Hari for the dump mode issue.
On 03/13/19 at 08:28pm, Kairui Song wrote:
Use "kdumpctl rebuild" to rebuild the image directly. This
could help
admins to rebuild kdump image directly.
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
kdumpctl | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/kdumpctl b/kdumpctl
index 1cfbe31..e223224 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -1141,6 +1141,27 @@ stop()
return 0
}
+rebuild() {
+ setup_initrd
+ if [ $? -ne 0 ]; then
+ return 1
+ fi
+
+ if [[ ! -w "$KDUMP_BOOTDIR" ]];then
+ echo "$KDUMP_BOOTDIR does not have write permission. Can not rebuild
$TARGET_INITRD"
+ return 1
+ fi
+
+ handle_mode_switch
+ if [ $? -ne 0 ]; then
+ return 1
+ fi
Maybe handle_mode_switch can be moved to rebuild_initrd()
then we do not need it in this function.
> +
> + echo "Rebuilding $TARGET_INITRD"
> + rebuild_initrd
> + return $?
> +}
> +
> if [ ! -f "$KDUMP_CONFIG_FILE" ]; then
> echo "Error: No kdump config file found!" >&2
> exit 1
> @@ -1185,6 +1206,9 @@ main ()
> stop
> start
> ;;
> + rebuild)
> + rebuild
> + ;;
> condrestart)
> ;;
> propagate)
> @@ -1194,7 +1218,7 @@ main ()
> show_reserved_mem
> ;;
> *)
> - echo $"Usage: $0 {start|stop|status|restart|reload|propagate|showmem}"
> + echo $"Usage: $0
{start|stop|status|restart|reload|rebuild|propagate|showmem}"
> exit 1
> esac
> }
> --
> 2.20.1
>