[-]
[+]
|
Changed |
j0ke-worker.spec
|
|
[-]
[+]
|
Changed |
obsworker
^
|
@@ -83,6 +83,10 @@
OBS_WORKER_OPT="$OBS_WORKER_OPT --cachesize $OBS_CACHE_SIZE "
fi
+if [ -z "$OBS_WORKER_USE_LVM" ]; then
+ OBS_WORKER_USE_LVM="no"
+fi
+
if [ -f /etc/buildhost.config ];then
. /etc/buildhost.config
obsopt=--xen
@@ -120,6 +124,13 @@
[ -n "$OBS_WORKER_DIRECTORY" ] && ROOT="$OBS_WORKER_DIRECTORY"
echo "Run $NUM obsworker using $ROOT"
+ pvs=( `vgdisplay -v abuild 2>/dev/null | grep "PV Name" | awk '{ print $3 }'` )
+ pv_idx=0
+ pv_count=${#pvs[@]}
+ pv_count=$(( ($pv_count / 2) * 2 )) # be sure that we have an equal number
+ o1=0
+ o2=1
+
# fetch worker sources from server
pushd "$workerbootdir"
curl -q "${OBS_WORKER_PARM}"/getworkercode | cpio --extract
@@ -128,8 +139,9 @@
popd
# cleanup stale loops
- for a in `losetup -a|awk -F: '{print $1}'` ; do losetup -d $a ; done
-
+ if [ "$OBS_WORKER_USE_LVM" == "no" ] ; then
+ for a in `losetup -a|awk -F: '{print $1}'` ; do losetup -d $a ; done
+ fi
while test "$NUM" -gt "$I"; do
if [ "$OBS_WORKER_PORTBASE" -gt 0 ]; then
port="--port $((OBS_WORKER_PORTBASE + I))"
@@ -138,11 +150,6 @@
fi
I=$(( $I + 1 ))
title="$HOSTNAME/$I"
- # prepare obsworker startup in screen...
- echo "screen -t $title ./bs_worker $obsopt $port --root $ROOT/root_$I" \
- "--statedir $workerdir/$I --id $HOSTNAME/$I $OBS_REPO_PARM" \
- "$OBS_JOBS $OBS_TEST $OBS_SRC_PARM $OBS_WORKER_OPT" \
- >> $screenrc
mkdir $workerdir/$I
# prepare xen build setup...
# requires the file /etc/buildhost.config which contains
@@ -158,10 +165,31 @@
mkdir -p $ROOT/root_$I
fi
if [ ! -z $obsopt ];then
- dd if=/dev/zero of=$ROOT/root_$I/root bs=1M seek=$XEN_ROOT count=1
- dd if=/dev/zero of=$ROOT/root_$I/swap bs=1M seek=$XEN_SWAP count=1
- echo $XEN_MEMX > $ROOT/root_$I/memory
+ if [ "$OBS_WORKER_USE_LVM" == "yes" ] ; then
+ xen_opts="--xendevice /dev/abuild/${I}_root --xenswap /dev/abuild/${I}_swap"
+ lvdisplay abuild >& /dev/null || exit
+ lvm lvcreate -n ${I}_root -L ${XEN_ROOT}M abuild ${pvs[$(( $pv_idx + $o1 ))]} || exit
+ lvm lvcreate -n ${I}_swap -L ${XEN_SWAP}M abuild ${pvs[$(( $pv_idx + $o2 ))]} || exit
+ pv_idx=$(( $pv_idx + 2 ))
+ if [ $pv_idx -ge $pv_count ]; then
+ pv_idx=0
+ # swap offset, so that swap and root partitions are not on same device
+ a=$o1
+ o1=$o2
+ o2=$a
+ fi
+ else
+ xen_opts="--xendevice $ROOT/root_$I/root --xenswap $ROOT/root_$I/swap"
+ dd if=/dev/zero of=$ROOT/root_$I/root bs=1M seek=$XEN_ROOT count=1
+ dd if=/dev/zero of=$ROOT/root_$I/swap bs=1M seek=$XEN_SWAP count=1
+ echo $XEN_MEMX > $ROOT/root_$I/memory
+ fi
fi
+ # prepare obsworker startup in screen...
+ echo "screen -t $title ./bs_worker $obsopt $xen_opts $port --root $ROOT/root_$I" \
+ "--statedir $workerdir/$I --id $HOSTNAME/$I $OBS_REPO_PARM" \
+ "$OBS_JOBS $OBS_TEST $OBS_SRC_PARM $OBS_WORKER_OPT" \
+ >> $screenrc
done
pushd "$workerbootdir"
screen -m -d -c $screenrc
|
[-]
[+]
|
Changed |
sysconfig.obs-worker
^
|
@@ -90,7 +90,7 @@
OBS_USE_SLP=""
## Path: Applications/OBS
-## Description: Register in SLP server
+## Description: Cache directory
## Type: string
## Default: ""
## Config: OBS
@@ -99,10 +99,17 @@
OBS_CACHE_DIR="/home/obs/cache"
## Path: Applications/OBS
-## Description: Register in SLP server
+## Description: Cache directory size
## Type: size in MB
## Default: ""
## Config: OBS
#
#
OBS_CACHE_SIZE="5120"
+
+## Path: Applications/OBS
+## Description: Use LVM for worker
+## Type: ("yes" | "no")
+## Default: "no"
+## Config: OBS
+OBS_WORKER_USE_LVM="no"
|