On 2016/09/06 at 14:34, Pratyush Anand wrote:
On 30/08/2016:04:21:19 PM, Xunlei Pang wrote:
> This is useful for memory/cpu hotplug udev events. With this
> function, we can add "ExecReload=/usr/bin/kdumpctl reload" in
> "kdump.service", and "/bin/systemctl reload kdump.service" will
> trigger the kdump kernel reload.
>
> We will specify it in "/usr/lib/udev/rules.d/98-kexec.rules" as
> the "PROGRAM" executed as follows:
> PROGRAM="/bin/systemctl reload-or-try-restart kdump.service"
> instead of
> PROGRAM="/bin/systemctl try-restart kdump.service"
>
> Signed-off-by: Xunlei Pang <xlpang(a)redhat.com>
> ---
> kdumpctl | 29 ++++++++++++++++++++++++++++-
> 1 file changed, 28 insertions(+), 1 deletion(-)
>
> diff --git a/kdumpctl b/kdumpctl
> index 69b2f3b..811d7f2 100755
> --- a/kdumpctl
> +++ b/kdumpctl
> @@ -615,7 +615,7 @@ need_64bit_headers()
> print (strtonum("0x" r[2]) > strtonum("0xffffffff"));
}'`
> }
>
> -# Load the kdump kerel specified in /etc/sysconfig/kdump
> +# Load the kdump kernel specified in /etc/sysconfig/kdump
> # If none is specified, try to load a kdump kernel with the same version
> # as the currently running kernel.
> load_kdump()
> @@ -664,6 +664,30 @@ load_kdump()
> fi
> }
>
> +# Reload the kdump kernel specified in /etc/sysconfig/kdump.
> +# If none is specified, try to load a kdump kernel with the same version
> +# as the currently running kernel.
> +#
> +# This is useful for memory/cpu hotplug udev events. With this function,
> +# we can add "ExecReload=/usr/bin/kdumpctl reload" in
"kdump.service",
> +# and "/bin/systemctl reload kdump.service" will trigger the kernel
reload.
> +
> +# We use it as "PROGRAM" executed in
"/usr/lib/udev/rules.d/98-kexec.rules":
> +# PROGRAM="/bin/systemctl reload-or-try-restart kdump.service"
> +reload_dump()
> +{
> + # Since systemctl reload kdump.service is called to enter it, we must have
> + # an active kdump.service, thus we assume all prerequisites are going well
> + # and call kexec -p (for kdump) to reload the kernel without any validation.
> +
Probably, calling check_current_status() here would be good. We should go for
prepare_dump only when "Kdump already running", otherwise a restart should be
preferred instead of reload.
Yes, adding it is a guarantee. The reason why I didn't add it is that this function
is used for memory/cpu hotplug udev events, sometimes the number of memory
events is huge, adding it may consumes some time.
The purpose of this function is for systemd service reload, if it is called when the
service is not running(like the comment I wrote above the code), it will not take
any effect, i.e. systemd will abort and can't reach reload_dump().
Regards,
Xunlei
~Pratyush
> + prepare_dump
> + if [ $? -ne 0 ]; then
> + return
> + fi
> +
> + start_dump
> +}
> +
> check_ssh_config()
> {
> while read config_opt config_val; do
> @@ -1146,6 +1170,9 @@ main ()
> stop
> start
> ;;
> + reload)
> + reload_dump
> + ;;
> condrestart)
> ;;
> propagate)
> --
> 1.8.3.1
> _______________________________________________
> kexec mailing list
> kexec(a)lists.fedoraproject.org
>
https://lists.fedoraproject.org/admin/lists/kexec@lists.fedoraproject.org