Remove sw-patch-agent service

sw-patch-agent service would cause unwanted
reboots and conflicts with the USM patching strategy:

sw-patch-agent can interfere with software-agent and incorrectly
flag the host as reboot-required after noticing that it's not
patch-current by sw-patch standards

Logs will typically look like this before each reboot:

sw-patch-agent[2049]: patch_agent.py(390): INFO: Active Sysroot
Commit:650ace717b24afd2e7283cc6ce8b01f13adce84db95e03685610e120424610b9
does not match active controller's Feed Repo Commit:
028e1fa688afaa27aa7a34d4b5ee9eeb8d188b691ba3e558c409bb58e0e83fe2
sw-patch: Node has been patched, with reboot-required flag set.
Rebooting

Since sw-patch-agent is no longer needed, it's to be removed.

Depends-On: https://review.opendev.org/c/starlingx/stx-puppet/+/935555

Test-Plan:
PASS: AIO-SX upgrade using sw-manager strategy
PASS: AIO-DX System Controller upgrade using strategy
PASS: subcloud upgrade using dcmanager strategy
PASS: DC patch orchestration for n-1 subclouds

Story: 2010676
Task: 51387

Change-Id: I2af7dfab9da89eeba4ffef3fa0d884ae6f2c354f
Signed-off-by: mmachado <mmachado@windriver.com>
This commit is contained in:
mmachado 2024-11-18 16:03:04 -03:00 committed by Matheus Machado Guilhermino
parent 961cee6dc5
commit 196534120c
15 changed files with 1 additions and 258 deletions

View File

@ -48,7 +48,6 @@ function install_sw_patch {
$STX_SUDO install -m 755 -d ${stx_patch_sysconfdir}/patching
$STX_SUDO install -m 755 -d ${stx_patch_sysconfdir}/patching/patch-scripts
$STX_SUDO install -m 755 -d ${stx_patch_sysconfdir}/pmon.d
$STX_SUDO install -m 500 $STX_PATCH_DIR/bin/sw-patch-agent ${stx_patch_sbindir}/sw-patch-agent
}
function install_update {

View File

@ -26,12 +26,6 @@
#
declare -i GLOBAL_RC=$PATCH_STATUS_OK
#
# First up, we'll handle restarting the patch-agent, which runs on all nodes
# Since the patch-agent is a delayed restart, there's no error to return
#
/usr/sbin/sw-patch-agent-restart
#
# Next, handle restarting the patch-controller.
#

View File

@ -118,7 +118,6 @@ refresh_init_links() {
ln -s /usr/share/starlingx/pmon.d/sm.conf /etc/pmon.d/sm.conf
ln -s /usr/share/starlingx/pmon.d/sshd.conf /etc/pmon.d/sshd.conf
ln -s /usr/share/starlingx/pmon.d/sssd.conf /etc/pmon.d/sssd.conf
ln -s /usr/share/starlingx/pmon.d/sw-patch-agent.conf /etc/pmon.d/sw-patch-agent.conf
ln -s /usr/share/starlingx/pmon.d/sw-patch-controller-daemon.conf /etc/pmon.d/sw-patch-controller-daemon.conf
ln -s /usr/share/starlingx/pmon.d/sysinv-agent.conf /etc/pmon.d/sysinv-agent.conf
ln -s /usr/share/starlingx/pmon.d/syslog-ng.conf /etc/pmon.d/syslog-ng.conf
@ -142,7 +141,6 @@ refresh_init_links() {
ln -s /usr/share/starlingx/pmon.d/sm-eru.conf /etc/pmon.d/sm-eru.conf
ln -s /usr/share/starlingx/pmon.d/sshd.conf /etc/pmon.d/sshd.conf
ln -s /usr/share/starlingx/pmon.d/sssd.conf /etc/pmon.d/sssd.conf
ln -s /usr/share/starlingx/pmon.d/sw-patch-agent.conf /etc/pmon.d/sw-patch-agent.conf
ln -s /usr/share/starlingx/pmon.d/sysinv-agent.conf /etc/pmon.d/sysinv-agent.conf
ln -s /usr/share/starlingx/pmon.d/syslog-ng.conf /etc/pmon.d/syslog-ng.conf
fi
@ -160,7 +158,6 @@ refresh_init_links() {
ln -s /usr/share/starlingx/pmon.d/sm-eru.conf /etc/pmon.d/sm-eru.conf
ln -s /usr/share/starlingx/pmon.d/sshd.conf /etc/pmon.d/sshd.conf
ln -s /usr/share/starlingx/pmon.d/sssd.conf /etc/pmon.d/sssd.conf
ln -s /usr/share/starlingx/pmon.d/sw-patch-agent.conf /etc/pmon.d/sw-patch-agent.conf
ln -s /usr/share/starlingx/pmon.d/sysinv-agent.conf /etc/pmon.d/sysinv-agent.conf
ln -s /usr/share/starlingx/pmon.d/syslog-ng.conf /etc/pmon.d/syslog-ng.conf
fi

View File

@ -1,19 +0,0 @@
[process]
process = sw-patch-agent
pidfile = /var/run/sw-patch-agent.pid
script = /etc/init.d/sw-patch-agent
style = lsb ; ocf or lsb
severity = major ; Process failure severity
; critical : host is failed
; major : host is degraded
; minor : log is generated
restarts = 3 ; Number of back to back unsuccessful restarts before severity assertion
interval = 5 ; Number of seconds to wait between back-to-back unsuccessful restarts
debounce = 20 ; Number of seconds the process needs to run before declaring
; it as running O.K. after a restart.
; Time after which back-to-back restart count is cleared.
startuptime = 10 ; Seconds to wait after process start before starting the debounce monitor
mode = passive ; Monitoring mode: passive (default) or active
; passive: process death monitoring (default: always)
; active: heartbeat monitoring, i.e. request / response messaging

View File

@ -1,16 +0,0 @@
#!/usr/bin/python
"""
Copyright (c) 2014 Wind River Systems, Inc.
SPDX-License-Identifier: Apache-2.0
"""
import sys
from cgcs_patch.patch_agent import main
if __name__ == "__main__":
main()

View File

@ -1,94 +0,0 @@
#!/bin/sh
#
# Copyright (c) 2014-2015 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
# chkconfig: 345 26 30
### BEGIN INIT INFO
# Provides: sw-patch-agent
# Required-Start: $syslog
# Required-Stop: $syslog
# Default-Start: 2 3 5
# Default-Stop: 0 1 6
# Short-Description: sw-patch-agent
# Description: Provides the CGCS Patch Agent Daemon
### END INIT INFO
DESC="sw-patch-agent"
DAEMON="/usr/sbin/sw-patch-agent"
PIDFILE="/var/run/sw-patch-agent.pid"
PATCH_INSTALLING_FILE="/var/run/patch_installing"
start()
{
if [ -e $PIDFILE ]; then
PIDDIR=/proc/$(cat $PIDFILE)
if [ -d ${PIDDIR} ]; then
echo "$DESC already running."
exit 1
else
echo "Removing stale PID file $PIDFILE"
rm -f $PIDFILE
fi
fi
echo -n "Starting $DESC..."
start-stop-daemon --start --quiet --background \
--pidfile ${PIDFILE} --make-pidfile --exec ${DAEMON}
if [ $? -eq 0 ]; then
echo "done."
else
echo "failed."
fi
}
stop()
{
if [ -f $PATCH_INSTALLING_FILE ]; then
echo "Patches are installing. Waiting for install to complete."
while [ -f $PATCH_INSTALLING_FILE ]; do
# Verify the agent is still running
pid=$(cat $PATCH_INSTALLING_FILE)
cat /proc/$pid/cmdline 2>/dev/null | grep -q $DAEMON
if [ $? -ne 0 ]; then
echo "Patch agent not running."
break
fi
sleep 1
done
echo "Continuing with shutdown."
fi
echo -n "Stopping $DESC..."
start-stop-daemon --stop --quiet --pidfile $PIDFILE
if [ $? -eq 0 ]; then
echo "done."
else
echo "failed."
fi
rm -f $PIDFILE
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|force-reload)
stop
start
;;
*)
echo "Usage: $0 {start|stop|force-reload|restart}"
exit 1
;;
esac
exit 0

View File

@ -1,20 +0,0 @@
#!/bin/bash
#
# Copyright (c) 2016 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
. /etc/patching/patch-functions
#
# Triggering a restart of the patching daemons is done by
# creating a flag file and letting the daemon handle the restart.
#
loginfo "Requesting restart of patch-agent"
restart_patch_agent_flag="/run/patching/.restart.patch-agent"
touch $restart_patch_agent_flag
exit 0

View File

@ -1,27 +0,0 @@
[Unit]
Description=StarlingX Patching Agent
After=syslog.target network-online.target sw-patch.service
Before=pmon.service
[Service]
Type=forking
User=root
ExecStart=/etc/init.d/sw-patch-agent start
ExecStop=/etc/init.d/sw-patch-agent stop
ExecReload=/etc/init.d/sw-patch-agent restart
PIDFile=/var/run/sw-patch-agent.pid
# cgroup performance engineering
# - sw-patch-agent.service does not provide latency critical service
# - ostree pull, ostree admin processes are 100% cpu hog;
# these do significant disk read and write IO
# - set 1/8th default share
# - set lower IO priority (effective only with 'bfq' scheduler)
CPUShares=128
Nice=19
IOSchedulingClass=best-effort
IOSchedulingPriority=7
[Install]
WantedBy=multi-user.target

View File

@ -1,7 +1,7 @@
[Unit]
Description=StarlingX Patching Controller
After=syslog.service network-online.target sw-patch.service
Before=sw-patch-agent.service sw-patch-controller-daemon.service
Before=sw-patch-controller-daemon.service
[Service]
Type=oneshot

View File

@ -123,58 +123,6 @@ if [ ${FOUND} -eq 0 ]; then
fi
RC=0
case "$1" in
start)
if [ "${system_mode}" = "simplex" ]; then
# On a simplex CPE, we need to launch the http server first,
# before we can do the patch installation
LOG_TO_FILE "***** Launching lighttpd *****"
/etc/init.d/lighttpd start
LOG_TO_FILE "***** Starting patch operation *****"
/usr/sbin/sw-patch-agent --install 2>>$logfile
if [ -f ${patch_failed_file} ]; then
RC=1
LOG_TO_FILE "***** Patch operation failed *****"
fi
LOG_TO_FILE "***** Finished patch operation *****"
LOG_TO_FILE "***** Shutting down lighttpd *****"
/etc/init.d/lighttpd stop
else
check_install_uuid
if [ $? -ne 0 ]; then
# The INSTALL_UUID doesn't match the active controller, so exit
exit 1
fi
LOG_TO_FILE "***** Starting patch operation *****"
/usr/sbin/sw-patch-agent --install 2>>$logfile
if [ -f ${patch_failed_file} ]; then
RC=1
LOG_TO_FILE "***** Patch operation failed *****"
fi
LOG_TO_FILE "***** Finished patch operation *****"
fi
check_for_rr_patch
;;
stop)
# Nothing to do here
;;
restart)
LOG_TO_FILE "***** Starting patch operation *****"
/usr/sbin/sw-patch-agent --install 2>>$logfile
if [ -f ${patch_failed_file} ]; then
RC=1
LOG_TO_FILE "***** Patch operation failed *****"
fi
LOG_TO_FILE "***** Finished patch operation *****"
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit $RC

View File

@ -1,7 +1,6 @@
[Unit]
Description=StarlingX Patching
After=syslog.target network-online.target
Before=sw-patch-agent.service
[Service]
Type=oneshot

View File

@ -1,3 +0,0 @@
etc/init.d
lib/systemd/system
usr/sbin

View File

@ -1,5 +0,0 @@
etc/init.d/sw-patch-agent
lib/systemd/system/sw-patch-agent.service
usr/sbin/sw-patch-agent
usr/sbin/sw-patch-agent-restart
usr/share/starlingx/pmon.d/sw-patch-agent.conf

View File

@ -1,2 +0,0 @@
init.d-script-missing-dependency-on-local_fs
non-standard-file-permissions-for-etc-init.d-script

View File

@ -33,24 +33,18 @@ override_dh_install:
install -m 755 -d ${DEBIAN_DESTDIR}/lib/systemd/system
install -m 755 -d ${PMONDIR}
install -m 500 bin/sw-patch-agent \
${DEBIAN_DESTDIR}/usr/sbin/sw-patch-agent
install -m 500 bin/sw-patch-controller-daemon \
${DEBIAN_DESTDIR}/usr/sbin/sw-patch-controller-daemon
install -m 555 bin/sw-patch \
${DEBIAN_DESTDIR}/usr/sbin/sw-patch
install -m 500 bin/sw-patch-controller-daemon-init.sh \
${DEBIAN_DESTDIR}/etc/init.d/sw-patch-controller-daemon
install -m 500 bin/sw-patch-agent-init.sh \
${DEBIAN_DESTDIR}/etc/init.d/sw-patch-agent
install -m 600 bin/patching.conf \
${DEBIAN_DESTDIR}/etc/patching/patching.conf
install -m 644 bin/policy.json \
${DEBIAN_DESTDIR}/etc/patching/policy.json
install -m 444 bin/pmon-sw-patch-controller-daemon.conf \
${PMONDIR}/sw-patch-controller-daemon.conf
install -m 444 bin/pmon-sw-patch-agent.conf \
${PMONDIR}/sw-patch-agent.conf
install -m 444 bin/*.service \
${DEBIAN_DESTDIR}/lib/systemd/system
install -m 444 bin/sw-patch.completion \
@ -63,8 +57,6 @@ override_dh_install:
${DEBIAN_DESTDIR}/usr/sbin/run-patch-scripts
install -m 500 bin/sw-patch-controller-daemon-restart \
${DEBIAN_DESTDIR}/usr/sbin/sw-patch-controller-daemon-restart
install -m 500 bin/sw-patch-agent-restart \
${DEBIAN_DESTDIR}/usr/sbin/sw-patch-agent-restart
install -m 500 bin/sw-patch-init.sh \
${DEBIAN_DESTDIR}/etc/init.d/sw-patch
install -m 500 bin/sw-patch-controller-init.sh \