Mailinglist Archive: opensuse-buildservice (219 mails)

< Previous Next >
[opensuse-buildservice] fixed port number for bs_worker
  • From: Michal Marek <mmarek@xxxxxxx>
  • Date: Fri, 15 Feb 2008 15:54:55 +0100
  • Message-id: <47B5A7BF.9090806@xxxxxxx>
Hi,

this adds option --port to bs_worker for people having issues with
opening all ports for the backend to connect to. It also adds
OBS_WORKER_PORTBASE sysconfig variable for the rpm package. I tried it
on one machine and it seems to work fine, the workers build and reboot
without problems.

OK to commit?

Michal
Index: dist/sysconfig.obs-worker
===================================================================
--- dist/sysconfig.obs-worker (revision 3128)
+++ dist/sysconfig.obs-worker (working copy)
@@ -28,3 +28,12 @@

OBS_WORKER_DIRECTORY=""

+## Path: Applications/OBS
+## Description: The base for port numbers used by worker instances
+## Type: integer
+## Default: "0"
+## Config: OBS
+#
+# 0 means let the operating system assign a port number
+
+OBS_WORKER_PORTBASE="0"
Index: dist/obsworker
===================================================================
--- dist/obsworker (revision 3128)
+++ dist/obsworker (working copy)
@@ -68,11 +68,16 @@
popd

while test "$NUM" -gt "$I"; do
+ if [ "$OBS_WORKER_PORTBASE" -gt 0 ]; then
+ port="--port $((OBS_WORKER_PORTBASE + I))"
+ else
+ port=""
+ fi
I=$(( $I + 1 ))
title="$HOSTNAME/$I"
# prepare obsworker startup in screen...
# FIXME: implement command line parameter to define the
server
- echo "screen -t $title ./bs_worker $obsopt --root
$ROOT/root_$I" \
+ echo "screen -t $title ./bs_worker $obsopt $port --root
$ROOT/root_$I" \
--statedir $workerdir/$I --id "$HOSTNAME/$I" \
>> $screenrc
mkdir $workerdir/$I
Index: src/backend/bs_worker
===================================================================
--- src/backend/bs_worker (revision 3128)
+++ src/backend/bs_worker (working copy)
@@ -38,6 +38,7 @@
use strict;

my $buildroot;
+my $port;
my $statedir;
my $hostarch;
my $xen = '';
@@ -104,6 +105,8 @@

--root : buildroot directory

+ --port : fixed port number
+
--statedir : state directory

--id : worker id
@@ -137,6 +140,11 @@
$buildroot = shift @ARGV;
next;
}
+ if ($ARGV[0] eq '--port') {
+ shift @ARGV;
+ $port = shift @ARGV;
+ next;
+ }
if ($ARGV[0] eq '--arch') {
shift @ARGV;
$hostarch = shift @ARGV;
@@ -511,7 +519,6 @@
chdir($statedir) || die("$statedir: $!\n");

BSServer::deamonize(@ARGV);
-my $port;

# calculate code meta md5
my $workercode = codemd5('worker');
@@ -525,7 +532,11 @@
commitstate({'state' => 'idle'});

# start server process...
-BSServer::serveropen(\$port);
+if ($port) {
+ BSServer::serveropen($port);
+} else {
+ BSServer::serveropen(\$port);
+}
mkdir($buildroot) unless -d $buildroot;
send_state('idle', $port, $hostarch);

< Previous Next >
Follow Ups