!45 [sync] PR-43: fix obsworker and obsschedule

From: @openeuler-sync-bot
Reviewed-by: @small_leek
Signed-off-by: @small_leek
This commit is contained in:
openeuler-ci-bot 2021-06-17 09:14:26 +00:00 committed by Gitee
commit dd9757f31e
3 changed files with 220 additions and 2 deletions

View File

@ -0,0 +1,174 @@
From 7d2d404c36e68ba7aaa1192f72c9f0e5524aa7ff Mon Sep 17 00:00:00 2001
From: caodongxia <315816521@qq.com>
Date: Thu, 17 Jun 2021 09:39:39 +0800
Subject: [PATCH] patch
---
dist/obsscheduler | 35 +++-------------------------------
dist/obsworker | 48 +++--------------------------------------------
2 files changed, 6 insertions(+), 77 deletions(-)
diff --git a/dist/obsscheduler b/dist/obsscheduler
index d7f49db..66af2d0 100755
--- a/dist/obsscheduler
+++ b/dist/obsscheduler
@@ -3,8 +3,6 @@
#
# Author: adrian@suse.de
-. /etc/rc.status
-
. /etc/sysconfig/obs-server
# Determine the base and follow a runlevel link name.
@@ -42,22 +40,18 @@ if test -z "$OBS_SCHEDULER_ARCHITECTURES" ; then
fi
-rc_reset
case "$1" in
start)
- echo -n "Initializing obsscheduler"
mkdir -p "$rundir" "$logdir"
chown obsrun:obsrun "$logdir" "$rundir"
cd "$obsdir"
# FIXME: not nice, this should receive a proper daemon handling,
# including real logging, pid file and startproc
for i in $OBS_SCHEDULER_ARCHITECTURES; do
- ./bs_sched $i >> "$logdir"/scheduler_$i.log 2>&1 &
+ $OBS_SCHEDULER_WRAPPER ./bs_sched $i >> "$logdir"/scheduler_$i.log 2>&1 &
done
- rc_status -v
;;
- stop|shutdown)
- echo -n "Shutting down obsscheduler"
+ stop)
if checkproc bs_sched; then
for i in $OBS_SCHEDULER_ARCHITECTURES; do
$obsdir/bs_admin --shutdown-scheduler "$i"
@@ -70,32 +64,9 @@ case "$1" in
killall bs_sched
fi
fi
- rc_status -v
- ;;
- restart)
- $0 stop
- $0 start
- rc_status
- ;;
- try-restart|reload)
- $0 status
- if test $? = 0; then
- $0 restart
- else
- rc_reset # Not running is not a failure.
- fi
- # Remember status and be quiet
- rc_status
- ;;
- status)
- echo -n "Checking for obsscheduler: "
- # FIXME: needs proper checking for all invoked schedulers
- checkproc bs_sched
- rc_status -v
;;
*)
- echo "Usage: $0 {start|stop|status|try-restart|restart|reload}"
+ echo "Usage: $0 {start|stop}"
exit 1
;;
esac
-rc_exit
diff --git a/dist/obsworker b/dist/obsworker
index 7d991ba..85e4f8b 100755
--- a/dist/obsworker
+++ b/dist/obsworker
@@ -4,22 +4,6 @@
# Author: adrian@suse.de
#
# /etc/init.d/obsworker
-# and its symbolic link
-# /usr/sbin/rcobsworker
-#
-### BEGIN INIT INFO
-# Provides: obsworker
-# Required-Start: $time $network $syslog
-# Required-Stop: $time $network $syslog
-# Should-Start: $remote_fs obsstoragesetup obssrcserver obsrepserver xendomains
-# Should-Stop: $none
-# Default-Start: 3 5
-# Default-Stop: 0 1 2 4 6
-# Short-Description: OBS worker
-# Description: Open Build Service worker
-### END INIT INFO
-
-. /etc/rc.status
# Is the worker running on Fedora >= 17 ?
# It lacks the complete path to build other distros then
@@ -334,7 +318,6 @@ EOF
fi
}
-rc_reset
case "$1" in
start)
# reset screenrc
@@ -353,8 +336,8 @@ case "$1" in
NUM=`ls -d /sys/devices/system/cpu/cpu[0-9]* | wc -l`
fi
if [ "--zvm" == "$vmopt" ]; then
- check_vmcp || rc_status -v
- create_initrd $OBS_VM_KERNEL $OBS_VM_INITRD || rc_status -v
+ check_vmcp || exit 1
+ create_initrd $OBS_VM_KERNEL $OBS_VM_INITRD || exit 1
if [ -n "$OBS_WORKER_INSTANCE_NAMES" ]; then
WORKERS=($OBS_WORKER_INSTANCE_NAMES)
NUM=${#WORKERS[*]}
@@ -483,7 +466,6 @@ case "$1" in
popd > /dev/null
;;
stop)
- echo -n "Shutting down obsworker"
for I in "$workerdir"/*; do
test -d "$I" || continue
test -e "$I/state" || continue
@@ -496,33 +478,9 @@ case "$1" in
sleep 2
killall -s 9 bs_worker 2>/dev/null
screen -S obsworker -X quit
- rc_status -v
- ;;
- restart)
- ## If first returns OK call the second, if first or
- ## second command fails, set echo return value.
- $0 stop
- $0 start
- rc_status
- ;;
- try-restart|reload)
- $0 status
- if test $? = 0; then
- $0 restart
- else
- rc_reset # Not running is not a failure.
- fi
- # Remember status and be quiet
- rc_status
- ;;
- status)
- echo -n "Checking for obsworker: "
- checkproc bs_worker
- rc_status -v
;;
*)
- echo "Usage: $0 {start|stop|status|try-restart|restart|reload}"
+ echo "Usage: $0 {start|stop}"
exit 1
;;
esac
-rc_exit
--
2.27.0

View File

@ -0,0 +1,35 @@
From 566516386b56023059d5b6f759bb4d648e88f724 Mon Sep 17 00:00:00 2001
From: caodongxia <315816521@qq.com>
Date: Thu, 17 Jun 2021 15:23:32 +0800
Subject: [PATCH] patch
---
dist/obsscheduler | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dist/obsscheduler b/dist/obsscheduler
index 66af2d0..bbbc1c7 100755
--- a/dist/obsscheduler
+++ b/dist/obsscheduler
@@ -52,15 +52,15 @@ case "$1" in
done
;;
stop)
- if checkproc bs_sched; then
+ if ps aux | grep bs_sched | grep -v grep &> /dev/null ; then
for i in $OBS_SCHEDULER_ARCHITECTURES; do
$obsdir/bs_admin --shutdown-scheduler "$i"
done
for i in `seq 600`; do
- checkproc bs_sched || break
+ ps aux | grep bs_sched | grep -v grep &> /dev/null || break
sleep 1
done
- if checkproc bs_sched ; then
+ if ps aux | grep bs_sched | grep -v grep &> /dev/null ; then
killall bs_sched
fi
fi
--
2.27.0

View File

@ -5,7 +5,7 @@
Name: obs-server
Version: 2.10.1
Release: lp151.23.8
Release: lp151.23.9
Summary: The Open Build Service -- Server Component
License: GPL-2.0-only or GPL-3.0-only
URL: http://www.openbuildservice.org
@ -15,7 +15,8 @@ Source0: open-build-service-%version.tar.xz
Patch1: 0001-obs_server-fix-usage-info.patch
Patch2: 0002-CVE-2020-8020.patch
Patch3: 0003-CVE-2020-8021.patch
Patch4: 0004-remove-systemV-method.patch
Patch5: 0005-obsscheduler-stop.patch
BuildArch: noarch
BuildRequires: python-devel, /usr/bin/xmllint, openssl, perl-BSSolv, perl-Compress-Zlib, xz
@ -121,6 +122,10 @@ ln -sf application-*.js application.js
ln -sf webui2-*.css webui2.css
cd -
[-d $RPM_BUILD_ROOT/etc/sysconfig] || mkdir -p $RPM_BUILD_ROOT/etc/sysconfig
install -m 0644 dist/sysconfig.obs-server $RPM_BUILD_ROOT/etc/sysconfig/obs-server
%if %{do_check}
%check
export DESTDIR=$RPM_BUILD_ROOT
@ -314,6 +319,7 @@ fi
/usr/lib/obs/server/BSConfig.pm
/usr/lib/obs/tests/*
%config(noreplace) /etc/logrotate.d/obs-server
%config(noreplace) /etc/sysconfig/obs-server
%{_unitdir}/obsservice.service
%{_unitdir}/obsscheduler.service
%{_unitdir}/obssrcserver.service
@ -480,6 +486,9 @@ usermod -a -G docker obsservicerun
%{_sbindir}/rcobsstoragesetup
%changelog
* Thu Jun 17 2021 caodongxia <caodongxia@huawei.com> - 2.10.1-lp151.23.9
- Fix obsworker and obsscheduler.
* Thu Nov 26 2020 yanglongkang <yanglongkang@huawei.com> - 2.10.1-lp151.23.8
- Delete %insserv_cleanup.
Add missing macros.