From: Olaf Hering Subject: [PATCH 2/5] tools/hotplug: use existing sysconfig file for xenconsoled Date: Fri, 5 Dec 2014 13:05:49 +0100 Message-ID: <1417781152-9926-3-git-send-email-olaf@aepfle.de> References: <1417781152-9926-1-git-send-email-olaf@aepfle.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1417781152-9926-1-git-send-email-olaf@aepfle.de> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: Olaf Hering , Wei Liu , Ian Campbell , Stefano Stabellini , Ian Jackson List-Id: xen-devel@lists.xenproject.org There is no need to require the creation of a new sysconfig file to pass options to xenconsoled in the systemd service file. Reuse the existing xencommons file. This file already contains the variable XENCONSOLED_TRACE, which is used in the sysv runlevel script. - Adjust systemd service file to use XENCONSOLED_TRACE instead of XENCONSOLED_LOG - Move XENCONSOLED_ARGS and XENCONSOLED_LOG_DIR to the sysconfig file. - Enable XENCONSOLED_TRACE and set its value to "none" to have a value for --log in the service file. - Adjust the runlevel script to recognize also XENCONSOLED_ARGS and XENCONSOLED_LOG_DIR - Adjust the runlevel script to handle XENCONSOLED_TRACE properly. If an old sysconfig file exist the XENCONSOLED_TRACE will remain empty. Signed-off-by: Olaf Hering Cc: Ian Jackson Cc: Stefano Stabellini Cc: Ian Campbell Cc: Wei Liu --- tools/hotplug/Linux/init.d/sysconfig.xencommons.in | 17 +++++++++++++++-- tools/hotplug/Linux/init.d/xencommons.in | 5 +++-- tools/hotplug/Linux/systemd/xenconsoled.service.in | 7 ++----- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/tools/hotplug/Linux/init.d/sysconfig.xencommons.in b/tools/hotplug/Linux/init.d/sysconfig.xencommons.in index 3a34b33..6271c3e 100644 --- a/tools/hotplug/Linux/init.d/sysconfig.xencommons.in +++ b/tools/hotplug/Linux/init.d/sysconfig.xencommons.in @@ -2,8 +2,21 @@ ## Type: string ## Default: "none" # -# Log xenconsoled messages (cf xl dmesg) -#XENCONSOLED_TRACE=[none|guest|hv|all] +# Log xenconsoled messages (cf xl dmesg +# This can be [none|guest|hv|all] +XENCONSOLED_TRACE=none + +## Type: string +## Default: "" +# +# Additional command line arguments for xenconsoled +XENCONSOLED_ARGS= + +## Type: string +## Default: "@XEN_LOG_DIR@/console" +# +# Output directory for xenconsoled logfiles. +XENCONSOLED_LOG_DIR=@XEN_LOG_DIR@/console ## Type: string ## Default: xenstored diff --git a/tools/hotplug/Linux/init.d/xencommons.in b/tools/hotplug/Linux/init.d/xencommons.in index a1095c2..ddc8daa 100644 --- a/tools/hotplug/Linux/init.d/xencommons.in +++ b/tools/hotplug/Linux/init.d/xencommons.in @@ -95,8 +95,9 @@ do_start () { fi echo Starting xenconsoled... - test -z "$XENCONSOLED_TRACE" || XENCONSOLED_ARGS=" --log=$XENCONSOLED_TRACE" - ${SBINDIR}/xenconsoled --pid-file=$XENCONSOLED_PIDFILE $XENCONSOLED_ARGS + test -z "$XENCONSOLED_LOG_DIR" || XENCONSOLED_LOG_DIR="--log-dir=${XENCONSOLED_LOG_DIR}" + test -z "$XENCONSOLED_TRACE" || XENCONSOLED_TRACE=" --log=$XENCONSOLED_TRACE" + ${SBINDIR}/xenconsoled --pid-file=$XENCONSOLED_PIDFILE ${XENCONSOLED_LOG_DIR} ${XENCONSOLED_TRACE} $XENCONSOLED_ARGS echo Starting QEMU as disk backend for dom0 test -z "$QEMU_XEN" && QEMU_XEN="${LIBEXEC_BIN}/qemu-system-i386" $QEMU_XEN -xen-domid 0 -xen-attach -name dom0 -nographic -M xenpv -daemonize \ diff --git a/tools/hotplug/Linux/systemd/xenconsoled.service.in b/tools/hotplug/Linux/systemd/xenconsoled.service.in index cb44cd6..9f533ff 100644 --- a/tools/hotplug/Linux/systemd/xenconsoled.service.in +++ b/tools/hotplug/Linux/systemd/xenconsoled.service.in @@ -6,14 +6,11 @@ ConditionPathExists=/proc/xen/capabilities [Service] Type=simple -Environment=XENCONSOLED_ARGS= -Environment=XENCONSOLED_LOG=none -Environment=XENCONSOLED_LOG_DIR=@XEN_LOG_DIR@/console -EnvironmentFile=-@CONFIG_DIR@/@CONFIG_LEAF_DIR@/xenconsoled +EnvironmentFile=@CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons PIDFile=@XEN_RUN_DIR@/xenconsoled.pid ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities ExecStartPre=/bin/mkdir -p ${XENCONSOLED_LOG_DIR} -ExecStart=@sbindir@/xenconsoled --pid-file @XEN_RUN_DIR@/xenconsoled.pid --log=${XENCONSOLED_LOG} --log-dir=${XENCONSOLED_LOG_DIR} $XENCONSOLED_ARGS +ExecStart=@sbindir@/xenconsoled --pid-file @XEN_RUN_DIR@/xenconsoled.pid --log=${XENCONSOLED_TRACE} --log-dir=${XENCONSOLED_LOG_DIR} $XENCONSOLED_ARGS [Install] WantedBy=multi-user.target