!54 fix obsscheduler and obsworker

From: @caodongxia
Reviewed-by: @small_leek
Signed-off-by: @small_leek
This commit is contained in:
openeuler-ci-bot 2021-08-22 05:04:02 +00:00 committed by Gitee
commit 71821e92ef
6 changed files with 291 additions and 1 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

@ -0,0 +1,22 @@
From f09770635d1dbf86085ece2a8000a909f4950f97 Mon Sep 17 00:00:00 2001
From: wang_yue111 <648774160@qq.com>
Date: Mon, 28 Jun 2021 16:13:49 +0800
Subject: [PATCH] change rubygem-bundler bundled version to fix compilation error
---
src/api/Gemfile.lock | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/api/Gemfile.lock b/src/api/Gemfile.lock
index c8cce14..427b747 100644
--- a/src/api/Gemfile.lock
+++ b/src/api/Gemfile.lock
@@ -579,4 +579,4 @@ DEPENDENCIES
yajl-ruby
BUNDLED WITH
- 1.17.1
+ 2.2.19
--
2.23.0

View File

@ -0,0 +1,20 @@
From 000f42efd6d3817cbded659de101af2e4a5bcc18 Mon Sep 17 00:00:00 2001
From: baizg1107 <preloyalwhite@163.com>
Date: Thu, 17 Jun 2021 17:05:38 +0800
Subject: [PATCH] fix obs productconvert inputfile path
---
dist/obs_productconvert | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dist/obs_productconvert b/dist/obs_productconvert
index 8a7f4cc..6005d90 100755
--- a/dist/obs_productconvert
+++ b/dist/obs_productconvert
@@ -1,2 +1,2 @@
#!/bin/bash
-exec /usr/lib/obs/server/bs_productconvert "$@"
+exec /usr/lib/obs/server/bs_productconvert ${PWD}"/$@"
--
2.27.0

View File

@ -6,7 +6,7 @@
Name: obs-server
Version: 2.10.7
Release: 6
Release: 7
Summary: The Open Build Service -- Server Component
License: GPL-2.0-only OR GPL-3.0-only
URL: http://www.openbuildservice.org
@ -14,6 +14,11 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build
Source0: https://github.com/openSUSE/open-build-service/archive/2.10.7.tar.gz
Source1: Gemfile.lock
Patch1: 0001-obs_server-fix-usage-info.patch
Patch2: fix-obs_productconvert-inputfile-path.patch
Patch3: change-bundled-rubygem-bundler-version.patch
Patch4: 0004-remove-systemV-method.patch
Patch5: 0005-obsscheduler-stop.patch
Patch6: obs_project_update-should-tell-the-usage-but-not-hung-still.patch
BuildArch: noarch
@ -123,6 +128,9 @@ 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
@ -316,6 +324,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
@ -482,6 +491,9 @@ usermod -a -G docker obsservicerun
%{_sbindir}/rcobsstoragesetup
%changelog
* Sat Aug 21 2021 caodongxia <caodongxia@huawei.com> - 2.10.7-7
- fix obsscheduler and obsworker
* Wed Jun 9 2021 zhaomengchao <zhaomengchao3@huawei.com> - 2.10.7-6
- fix obs-server Compilation Failed

View File

@ -0,0 +1,27 @@
From 29a123a92e31dbdc137e94428323c75d7a0c215b Mon Sep 17 00:00:00 2001
From: si-gui <sunguoshuai@huawei.com>
Date: Thu, 17 Jun 2021 16:34:05 +0800
Subject: [PATCH] obs_project_update should tell the usage but not hung still
---
dist/obs_project_update | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/dist/obs_project_update b/dist/obs_project_update
index 07c8233..1da43ce 100755
--- a/dist/obs_project_update
+++ b/dist/obs_project_update
@@ -17,6 +17,10 @@
# $ echo "kiwi deb" | obs_project_update -u https://api.opensuse.org OBS:Server:2.4 https://api.yourdomain.ext OBS:Server:2.4
#
usage="usage: $0 {-e | -u} <source obs> <source project> <target obs> <target project> [listfile]"
+if [ $# -lt 5 ];then
+ echo $usage
+ exit 1
+fi
srcexpand='-e'
dstexpand='-u'
--
2.30.0