Fix failing mtce services on Debian

Modified mtce and mtce-control to address the following
failing services on Debian:
hbsAgent.service
hbsClient.service
hwmon.service
lmon.service
mtcalarm.service
mtclog.service
runservices.service

Applied fix:
- Included modified .service files for debian
directly into into the deb_folder.
- Changed the init files to account for the different
locations of the init-functions and service daemons
on Debian and CentOS
- Included "override_dh_installsystemd" section
to rules in order to start services at boot.

Test Plan:

PASS: Package installed and ISO built successfully
PASS: Ran "systemctl list-units --failed" and verified that the
services are not failing
PASS: Ran "systemctl status <service_name>" for
each service and verified that they are active

Story: 2009101
Task: 44192

Signed-off-by: Matheus Machado Guilhermino <Matheus.MachadoGuilhermino@windriver.com>
Change-Id: I50915c17d6f50f5e20e6448d3e75bfe54a75acc0
This commit is contained in:
Matheus Machado Guilhermino 2022-01-14 10:50:09 -03:00
parent 14cac85e31
commit 4c8abe18d3
21 changed files with 217 additions and 32 deletions

View File

@ -0,0 +1,13 @@
[Unit]
Description=StarlingX Maintenance Heartbeat Agent
After=hbsClient.service
Before=pmon.service
[Service]
Type=forking
ExecStart=/etc/init.d/hbsAgent start
ExecStop=/etc/init.d/hbsAgent stop
PIDFile=/var/run/hbsAgent.pid
[Install]
WantedBy=multi-user.target

View File

@ -1,4 +1,3 @@
etc/init.d/goenabledControl
etc/init.d/hbsAgent
etc/pmon.d/hbsAgent.conf
lib/systemd/system/hbsAgent.service

View File

@ -4,7 +4,6 @@
export ROOT = debian/tmp
export INITDIR = $(ROOT)/etc/init.d
export PMONDIR = $(ROOT)/etc/pmon.d
export SYSTEMDDIR = $(ROOT)/lib/systemd/system
%:
dh $@
@ -15,5 +14,6 @@ override_dh_auto_install:
install -m 755 -p -D scripts/hbsAgent $(INITDIR)
install -m 755 -d $(PMONDIR)
install -m 644 -p -D scripts/hbsAgent.conf $(PMONDIR)
install -m 755 -d $(SYSTEMDDIR)
install -m 644 -p -D scripts/hbsAgent.service $(SYSTEMDDIR)
override_dh_installsystemd:
dh_installsystemd --name hbsAgent

View File

@ -17,10 +17,22 @@
# Short-Description: Heartbeat Agent Daemon
### END INIT INFO
. /etc/init.d/functions
CENTOS_FUNCTIONS="/etc/init.d/functions"
DEBIAN_FUNCTIONS="/lib/lsb/init-functions"
if [ ! -f ${CENTOS_FUNCTIONS} ] ; then
. ${DEBIAN_FUNCTIONS}
else
. ${CENTOS_FUNCTIONS}
fi
DAEMON_NAME="hbsAgent"
DAEMON="/usr/local/bin/${DAEMON_NAME}"
DAEMON_CENTOS_PATH="/usr/local/bin/${DAEMON_NAME}"
DAEMON_DEBIAN_PATH="/usr/bin/${DAEMON_NAME}"
if [ ! -f ${DAEMON_CENTOS_PATH} ] ; then
DAEMON=${DAEMON_DEBIAN_PATH}
else
DAEMON=${DAEMON_CENTOS_PATH}
fi
PIDFILE="/var/run/${DAEMON_NAME}.pid"
VIRT_TOOL='virt-what'

View File

@ -0,0 +1,23 @@
[Unit]
Description=StarlingX Maintenance Heartbeat Client
After=network.target syslog.service config.service
Before=pmon.service mtcClient.service
[Service]
Type=forking
ExecStart=/etc/init.d/hbsClient start
ExecStop=/etc/init.d/hbsClient stop
ExecReload=/etc/init.d/hbsClient reload
PIDFile=/var/run/hbsClient.pid
# Failure handling
TimeoutStartSec=10s
TimeoutStopSec=10s
# process recovery is handled by pmond
Restart=no
RestartSec=5
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,16 @@
[Unit]
Description=StarlingX Hardware Monitor
After=network.target syslog.service
[Service]
Type=forking
ExecStart=/etc/init.d/hwmon start
ExecStop=/etc/init.d/hwmon stop
ExecReload=/etc/init.d/hwmon reload
PIDFile=/var/run/hwmond.pid
Restart=no
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,17 @@
[Unit]
Description=Starling-X Maintenance Link Monitor
After=config.service
After=syslog-ng.service
Before=pmon.service
[Service]
Type=forking
ExecStart=/etc/init.d/lmon start
ExecStop=/etc/init.d/lmon stop
ExecReload=/etc/init.d/lmon reload
PIDFile=/var/run/lmond.pid
KillMode=process
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,14 @@
[Unit]
Description=StarlingX Maintenance Alarm Handler Client
After=network.target syslog.service config.service
Before=pmon.service
[Service]
Type=forking
ExecStart=/etc/init.d/mtcalarm start
ExecStop=/etc/init.d/mtcalarm stop
ExecReload=/etc/init.d/mtcalarm reload
PIDFile=/var/run/mtcalarmd.pid
[Install]
WantedBy=multi-user.target

View File

@ -1,6 +1,5 @@
etc/init.d/hwmon
etc/logrotate.d/hwmon.logrotate
etc/mtc/hwmond.conf
lib/systemd/system/hwmon.service
usr/lib/ocf/resource.d/platform/hwmon
usr/bin/hwmond
usr/lib/ocf/resource.d/platform/hwmon

View File

@ -2,5 +2,4 @@ etc/init.d/lmon
etc/logrotate.d/lmon.logrotate
etc/mtc/lmond.conf
etc/pmon.d/lmon.conf
lib/systemd/system/lmon.service
usr/bin/lmond

View File

@ -2,10 +2,10 @@ etc/init.d/pmon
etc/logrotate.d/pmon.logrotate
etc/mtc/pmond.conf
lib/systemd/system/pmon.service
usr/bin/pmond
usr/lib/libamon.so
usr/lib/libamon.so.1
usr/lib/libamon.so.1.0
usr/bin/pmond
usr/sbin/pmon-restart
usr/sbin/pmon-start
usr/sbin/pmon-stop

View File

@ -34,11 +34,8 @@ etc/syslog-ng/conf.d/mtce.conf
lib/systemd/system/crashDumpMgr.service
lib/systemd/system/fsmon.service
lib/systemd/system/goenabled.service
lib/systemd/system/hbsClient.service
lib/systemd/system/mtcClient.service
lib/systemd/system/mtcalarm.service
lib/systemd/system/mtclog.service
lib/systemd/system/runservices.service
usr/lib/ocf/resource.d/platform/mtcAgent
usr/bin/fsmond
usr/bin/hbsAgent
usr/bin/hbsClient
@ -47,7 +44,6 @@ usr/bin/mtcClient
usr/bin/mtcalarmd
usr/bin/mtclogd
usr/bin/wipedisk
usr/lib/ocf/resource.d/platform/mtcAgent
usr/sbin/dmemchk.sh
usr/sbin/fsync
usr/share/mtce/hwclock.service

View File

@ -0,0 +1,23 @@
[Unit]
Description=StarlingX Maintenance Logger
After=network.target syslog.service config.service
Before=pmon.service
[Service]
Type=forking
ExecStart=/etc/init.d/mtclog start
ExecStop=/etc/init.d/mtclog stop
ExecReload=/etc/init.d/mtclog reload
PIDFile=/var/run/mtclogd.pid
# Failure handling
TimeoutStartSec=10s
TimeoutStopSec=10s
# process recovery is handled by pmond
Restart=no
RestartSec=5
[Install]
WantedBy=multi-user.target

View File

@ -91,17 +91,11 @@ override_dh_auto_install:
# systemd service files
install -m 755 -d $(UNITDIR)
install -m 644 -p -D fsmon/scripts/fsmon.service $(UNITDIR)/fsmon.service
install -m 644 -p -D hwmon/scripts/hwmon.service $(UNITDIR)/hwmon.service
install -m 644 -p -D pmon/scripts/pmon.service $(UNITDIR)/pmon.service
install -m 644 -p -D hostw/scripts/hostw.service $(UNITDIR)/hostw.service
install -m 644 -p -D scripts/crashDumpMgr.service $(UNITDIR)/crashDumpMgr.service
install -m 644 -p -D scripts/mtcClient.service $(UNITDIR)/mtcClient.service
install -m 644 -p -D scripts/hbsClient.service $(UNITDIR)/hbsClient.service
install -m 644 -p -D scripts/mtclog.service $(UNITDIR)/mtclog.service
install -m 644 -p -D scripts/goenabled.service $(UNITDIR)/goenabled.service
install -m 644 -p -D scripts/runservices.service $(UNITDIR)/runservices.service
install -m 644 -p -D alarm/scripts/mtcalarm.service $(UNITDIR)/mtcalarm.service
install -m 644 -p -D lmon/scripts/lmon.service $(UNITDIR)/lmon.service
# go enabled script
install -m 755 -p -D scripts/goenabled $(INITDIR)/goenabled
@ -162,5 +156,13 @@ override_dh_auto_install:
install -m 755 -d $(ROOT)/var
install -m 755 -d $(ROOT)/var/run
override_dh_installsystemd:
dh_installsystemd --name hbsClient
dh_installsystemd --name hwmon
dh_installsystemd --name lmon
dh_installsystemd --name mtcalarm
dh_installsystemd --name mtclog
dh_installsystemd --name runservices
override_dh_usrlocal:
echo "SKIPPING DH USRLOCAL"

View File

@ -0,0 +1,12 @@
[Unit]
Description=StarlingX Run Host Services
After=network.target syslog.service
[Service]
Type=simple
ExecStart=/etc/init.d/runservices start
ExecStop=/etc/init.d/runservices stop
[Install]
WantedBy=multi-user.target

View File

@ -1,4 +1,4 @@
etc/init.d/hostw
etc/logrotate.d/hostw.logrotate
etc/mtc/hostwd.conf
usr/local/bin/hostwd
usr/bin/hostwd

View File

@ -17,10 +17,22 @@
# Short-Description: Maintenance Alarm Daemon
### END INIT INFO
. /etc/init.d/functions
CENTOS_FUNCTIONS="/etc/init.d/functions"
DEBIAN_FUNCTIONS="/lib/lsb/init-functions"
if [ ! -f ${CENTOS_FUNCTIONS} ] ; then
. ${DEBIAN_FUNCTIONS}
else
. ${CENTOS_FUNCTIONS}
fi
DAEMON_NAME="mtcalarmd"
DAEMON="/usr/local/bin/${DAEMON_NAME}"
DAEMON_CENTOS_PATH="/usr/local/bin/${DAEMON_NAME}"
DAEMON_DEBIAN_PATH="/usr/bin/${DAEMON_NAME}"
if [ ! -f ${DAEMON_CENTOS_PATH} ] ; then
DAEMON=${DAEMON_DEBIAN_PATH}
else
DAEMON=${DAEMON_CENTOS_PATH}
fi
PIDFILE="/var/run/${DAEMON_NAME}.pid"
PLATFORM_CONF="/etc/platform/platform.conf"

View File

@ -17,10 +17,22 @@
# Short-Description: hwmon daemon
### END INIT INFO
. /etc/init.d/functions
CENTOS_FUNCTIONS="/etc/init.d/functions"
DEBIAN_FUNCTIONS="/lib/lsb/init-functions"
if [ ! -f ${CENTOS_FUNCTIONS} ] ; then
. ${DEBIAN_FUNCTIONS}
else
. ${CENTOS_FUNCTIONS}
fi
DAEMON_NAME="hwmond"
DAEMON="/usr/local/bin/${DAEMON_NAME}"
DAEMON_CENTOS_PATH="/usr/local/bin/${DAEMON_NAME}"
DAEMON_DEBIAN_PATH="/usr/bin/${DAEMON_NAME}"
if [ ! -f ${DAEMON_CENTOS_PATH} ] ; then
DAEMON=${DAEMON_DEBIAN_PATH}
else
DAEMON=${DAEMON_CENTOS_PATH}
fi
PIDFILE="/var/run/${DAEMON_NAME}.pid"
# Linux Standard Base (LSB) Error Codes

View File

@ -17,10 +17,22 @@
# Short-Description: Link Monitor daemon
### END INIT INFO
. /etc/init.d/functions
CENTOS_FUNCTIONS="/etc/init.d/functions"
DEBIAN_FUNCTIONS="/lib/lsb/init-functions"
if [ ! -f ${CENTOS_FUNCTIONS} ] ; then
. ${DEBIAN_FUNCTIONS}
else
. ${CENTOS_FUNCTIONS}
fi
DAEMON_NAME="lmond"
DAEMON="/usr/local/bin/${DAEMON_NAME}"
DAEMON_CENTOS_PATH="/usr/local/bin/${DAEMON_NAME}"
DAEMON_DEBIAN_PATH="/usr/bin/${DAEMON_NAME}"
if [ ! -f ${DAEMON_CENTOS_PATH} ] ; then
DAEMON=${DAEMON_DEBIAN_PATH}
else
DAEMON=${DAEMON_CENTOS_PATH}
fi
IFACE=""
if [ ! -e "$DAEMON" ] ; then

View File

@ -17,10 +17,22 @@
# Short-Description: Heartbeat Client Daemon
### END INIT INFO
. /etc/init.d/functions
CENTOS_FUNCTIONS="/etc/init.d/functions"
DEBIAN_FUNCTIONS="/lib/lsb/init-functions"
if [ ! -f ${CENTOS_FUNCTIONS} ] ; then
. ${DEBIAN_FUNCTIONS}
else
. ${CENTOS_FUNCTIONS}
fi
DAEMON_NAME="hbsClient"
DAEMON="/usr/local/bin/${DAEMON_NAME}"
DAEMON_CENTOS_PATH="/usr/local/bin/${DAEMON_NAME}"
DAEMON_DEBIAN_PATH="/usr/bin/${DAEMON_NAME}"
if [ ! -f ${DAEMON_CENTOS_PATH} ] ; then
DAEMON=${DAEMON_DEBIAN_PATH}
else
DAEMON=${DAEMON_CENTOS_PATH}
fi
PIDFILE="/var/run/${DAEMON_NAME}.pid"
IFACE=""

View File

@ -19,10 +19,22 @@
# Short-Description: mtclog daemon
### END INIT INFO
. /etc/init.d/functions
CENTOS_FUNCTIONS="/etc/init.d/functions"
DEBIAN_FUNCTIONS="/lib/lsb/init-functions"
if [ ! -f ${CENTOS_FUNCTIONS} ] ; then
. ${DEBIAN_FUNCTIONS}
else
. ${CENTOS_FUNCTIONS}
fi
DAEMON_NAME="mtclogd"
DAEMON="/usr/local/bin/${DAEMON_NAME}"
DAEMON_CENTOS_PATH="/usr/local/bin/${DAEMON_NAME}"
DAEMON_DEBIAN_PATH="/usr/bin/${DAEMON_NAME}"
if [ ! -f ${DAEMON_CENTOS_PATH} ] ; then
DAEMON=${DAEMON_DEBIAN_PATH}
else
DAEMON=${DAEMON_CENTOS_PATH}
fi
PIDFILE="/var/run/${DAEMON_NAME}.pid"
PLATFORM_CONF="/etc/platform/platform.conf"