From 987d5b9b7719155d7434b1dd7424689036b4c7fb Mon Sep 17 00:00:00 2001 From: Andrei Suciu Date: Wed, 23 Feb 2022 11:28:56 +0000 Subject: [PATCH] Debian: Fix mtce-guest services on Debian Modified mtce-guest to address the following failing services on Debian: guestAgent.service guestServer.service (the service provides a means of guest heartbeat orchestration under VIM (system management) control) Applied fix: - Included modified .service files for debian directly into the deb_folder. - Included "override_dh_installsystemd" section to rules in order to start guestServer at boot and guestAgent with --no-enable option - Removed guestAgent.service and guestServer.service install from Makefile to spec, in order to override (for CentOS build) - Modified service scripts to fork for Daemon location - Move binaries to usr/local/bin PASS: Package installed and ISO built on Debian successfully PASS: Services are running correctly after loading the image: guestServer is started automatically, guestAgent (--no-enable) runs correctly when started via systemctl PASS: guestServer runs as expected after bootstrap PASS: Package installed and ISO built on CentOS successfully PASS: Services are running on CentOS after bootstrap and unlock correctly Story: 2009101 Task: 44323 Change-Id: I856fcc78c41953ae37e7c2cf1361b4466b15720b --- mtce-guest/centos/mtce-guest.spec | 3 +++ .../debian/deb_folder/guestAgent.service | 16 +++++++++++++ .../debian/deb_folder/guestServer.service | 23 +++++++++++++++++++ .../deb_folder/mtce-guest-agent.install | 3 +-- .../deb_folder/mtce-guest-server.install | 3 +-- mtce-guest/debian/deb_folder/rules | 9 +++++++- mtce-guest/src/Makefile | 4 ---- 7 files changed, 52 insertions(+), 9 deletions(-) create mode 100644 mtce-guest/debian/deb_folder/guestAgent.service create mode 100644 mtce-guest/debian/deb_folder/guestServer.service diff --git a/mtce-guest/centos/mtce-guest.spec b/mtce-guest/centos/mtce-guest.spec index 8fda8ee7..6e431ad6 100644 --- a/mtce-guest/centos/mtce-guest.spec +++ b/mtce-guest/centos/mtce-guest.spec @@ -127,6 +127,9 @@ make install \ LOCALBINDIR=%{buildroot}%{local_bindir} \ UNITDIR=%{buildroot}%{_unitdir} +install -m 644 -p -D scripts/guestServer.service %{buildroot}%{_unitdir}/guestServer.service +install -m 644 -p -D scripts/guestAgent.service %{buildroot}%{_unitdir}/guestAgent.service + # enable all services in systemd %post -n mtce-guestServer /bin/systemctl enable guestServer.service diff --git a/mtce-guest/debian/deb_folder/guestAgent.service b/mtce-guest/debian/deb_folder/guestAgent.service new file mode 100644 index 00000000..f69e2634 --- /dev/null +++ b/mtce-guest/debian/deb_folder/guestAgent.service @@ -0,0 +1,16 @@ +[Unit] +Description=StarlingX Guest Agent +After=network.target syslog.service + +[Service] +Type=forking +ExecStart=/etc/init.d/guestAgent start +ExecStop=/etc/init.d/guestAgent stop +ExecReload=/etc/init.d/guestAgent reload +PIDFile=/var/run/guestAgent.pid + +Restart=no + +[Install] +WantedBy=multi-user.target + diff --git a/mtce-guest/debian/deb_folder/guestServer.service b/mtce-guest/debian/deb_folder/guestServer.service new file mode 100644 index 00000000..c2c9fe28 --- /dev/null +++ b/mtce-guest/debian/deb_folder/guestServer.service @@ -0,0 +1,23 @@ +[Unit] +Description=StarlingX Maintenance Guest Heartbeat Monitor Server +After=network.target syslog.service config.service +Before=pmon.service + +[Service] +Type=forking +ExecStart=/etc/init.d/guestServer start +ExecStop=/etc/init.d/guestServer stop +ExecReload=/etc/init.d/guestServer reload +PIDFile=/var/run/guestServer.pid + +# Failure handling +TimeoutStartSec=10s +TimeoutStopSec=10s + +# process recovery is handled by pmond +Restart=no +RestartSec=5 + +[Install] +WantedBy=multi-user.target + diff --git a/mtce-guest/debian/deb_folder/mtce-guest-agent.install b/mtce-guest/debian/deb_folder/mtce-guest-agent.install index 7990a45f..73df0fb9 100644 --- a/mtce-guest/debian/deb_folder/mtce-guest-agent.install +++ b/mtce-guest/debian/deb_folder/mtce-guest-agent.install @@ -1,6 +1,5 @@ -usr/bin/guestAgent +usr/local/bin/guestAgent usr/lib/ocf/resource.d/platform/guestAgent -lib/systemd/system/guestAgent.service etc/init.d/guestAgent etc/logrotate.d/guestAgent.logrotate etc/mtc/guestAgent.ini diff --git a/mtce-guest/debian/deb_folder/mtce-guest-server.install b/mtce-guest/debian/deb_folder/mtce-guest-server.install index 60ae5195..e067432a 100644 --- a/mtce-guest/debian/deb_folder/mtce-guest-server.install +++ b/mtce-guest/debian/deb_folder/mtce-guest-server.install @@ -1,5 +1,4 @@ -usr/bin/guestServer -lib/systemd/system/guestServer.service +usr/local/bin/guestServer etc/init.d/guestServer etc/logrotate.d/guestServer.logrotate etc/mtc/guestServer.ini diff --git a/mtce-guest/debian/deb_folder/rules b/mtce-guest/debian/deb_folder/rules index d5ffe296..3e377e27 100644 --- a/mtce-guest/debian/deb_folder/rules +++ b/mtce-guest/debian/deb_folder/rules @@ -3,7 +3,7 @@ export ROOT=debian/tmp -export BINDIR=/usr/bin +export BINDIR=/usr/local/bin export INITDIR=$(ROOT)/etc/init.d export LOGDIR=$(ROOT)/etc/logrotate.d export MTCDIR=$(ROOT)/etc/mtc @@ -33,5 +33,12 @@ override_dh_auto_install: install -d -m 755 $(PMONDIR) install -p -D -m 644 scripts/guestServer.pmon $(PMONDIR)/guestServer.conf +override_dh_installsystemd: + dh_installsystemd --name guestServer + dh_installsystemd --no-enable --name guestAgent + override_dh_fixperms: dh_fixperms -XguestAgent -XguestServer + +override_dh_usrlocal: + echo "SKIPPING DH USRLOCAL" diff --git a/mtce-guest/src/Makefile b/mtce-guest/src/Makefile index deaefa8d..082e478b 100644 --- a/mtce-guest/src/Makefile +++ b/mtce-guest/src/Makefile @@ -63,10 +63,6 @@ install: install -m 700 -p -D scripts/guestServer $(SYSCONFDIR)/init.d/guestServer install -m 700 -p -D scripts/guestAgent $(SYSCONFDIR)/init.d/guestAgent -# systemd service files - install -m 644 -p -D scripts/guestServer.service $(UNITDIR)/guestServer.service - install -m 644 -p -D scripts/guestAgent.service $(UNITDIR)/guestAgent.service - # process monitor config files install -m 755 -d $(SYSCONFDIR)/pmon.d install -m 644 -p -D scripts/guestServer.pmon $(SYSCONFDIR)/pmon.d/guestServer.conf