File xenwatchdogd-options.patch of Package xen.33625

From: Olaf Hering <olaf@aepfle.de>
Date: Thu, 3 Dec 2020 07:34:36 +0100
Subject: tools/hotplug: allow tuning of xenwatchdogd arguments
Git-commit: 0fb6dbfaa859aae0e51a82a8d5e213bcc64b85f1
References: bsc#1178736

Currently the arguments for xenwatchdogd are hardcoded with 15s
keep-alive interval and 30s timeout.

It is not possible to tweak these values via
/etc/systemd/system/xen-watchdog.service.d/*.conf because ExecStart
can not be replaced. The only option would be a private copy
/etc/systemd/system/xen-watchdog.service, which may get out of sync
with the Xen provided xen-watchdog.service.

Adjust the service file to recognize XENWATCHDOGD_ARGS= in a
private unit configuration file.
Index: xen-4.14.0-testing/tools/hotplug/Linux/init.d/xen-watchdog.in
===================================================================
--- xen-4.14.0-testing.orig/tools/hotplug/Linux/init.d/xen-watchdog.in
+++ xen-4.14.0-testing/tools/hotplug/Linux/init.d/xen-watchdog.in
@@ -19,6 +19,11 @@
 
 . @XEN_SCRIPT_DIR@/hotplugpath.sh
 
+xencommons_config=@CONFIG_DIR@/@CONFIG_LEAF_DIR@
+
+test -f $xencommons_config/xencommons && . $xencommons_config/xencommons
+
+test -n "$XENWATCHDOGD_ARGS" || XENWATCHDOGD_ARGS='30 15'
 DAEMON=${sbindir}/xenwatchdogd
 base=$(basename $DAEMON)
 
@@ -46,7 +51,7 @@ start() {
 	local r
 	echo -n $"Starting domain watchdog daemon: "
 
-	$DAEMON 30 15
+	$DAEMON $XENWATCHDOGD_ARGS
 	r=$?
 	[ "$r" -eq 0 ] && success $"$base startup" || failure $"$base startup"
 	echo
Index: xen-4.14.0-testing/tools/hotplug/Linux/systemd/xen-watchdog.service.in
===================================================================
--- xen-4.14.0-testing.orig/tools/hotplug/Linux/systemd/xen-watchdog.service.in
+++ xen-4.14.0-testing/tools/hotplug/Linux/systemd/xen-watchdog.service.in
@@ -6,7 +6,9 @@ ConditionPathExists=/proc/xen/capabiliti
 
 [Service]
 Type=forking
-ExecStart=@sbindir@/xenwatchdogd 30 15
+Environment="XENWATCHDOGD_ARGS=30 15"
+EnvironmentFile=-@CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons
+ExecStart=@sbindir@/xenwatchdogd $XENWATCHDOGD_ARGS
 KillSignal=USR1
 
 [Install]
openSUSE Build Service is sponsored by