Skip to content

Commit

Permalink
[dist] fix obstorage setup failures on worker-only appliance
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianschroeter committed May 4, 2016
1 parent 42dfe21 commit 23382bd
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions dist/obsstoragesetup
Expand Up @@ -242,15 +242,15 @@ case "$1" in
I=$(( $I + 1 ))

lverr=$(mktemp)
if ! lvcreate -n worker_root_${I} -L ${OBS_WORKER_ROOT_SIZE}M OBS ${pvs[$(( $pv_idx + $o1 ))]} 2> $lverr; then
if ! lvcreate --wipesignatures y -n worker_root_${I} -L ${OBS_WORKER_ROOT_SIZE}M OBS ${pvs[$(( $pv_idx + $o1 ))]} 2> $lverr; then
if grep "Insufficient free space" $lverr; then
I=$(( $I - 1 ))
else
cat $lverr >&2
exit
fi
else
lvcreate -n worker_swap_${I} -L ${OBS_WORKER_SWAP_SIZE}M OBS ${pvs[$(( $pv_idx + $o2 ))]} || exit
lvcreate --wipesignatures y -n worker_swap_${I} -L ${OBS_WORKER_SWAP_SIZE}M OBS ${pvs[$(( $pv_idx + $o2 ))]} || exit
fi
rm -f $lverr
pv_idx=$(( $pv_idx + 2 ))
Expand Down Expand Up @@ -279,14 +279,14 @@ case "$1" in
DEVS="$DEVS ${pvs[$(( $I * $disks_per_instance + $J ))]}"
done

lvcreate -n worker_root_${I} -i $disks_per_instance -L ${OBS_WORKER_ROOT_SIZE}M OBS $DEVS || exit
lvcreate -n worker_swap_${I} -i $disks_per_instance -L ${OBS_WORKER_SWAP_SIZE}M OBS $DEVS || exit
lvcreate --wipesignatures y -n worker_root_${I} -i $disks_per_instance -L ${OBS_WORKER_ROOT_SIZE}M OBS $DEVS || exit
lvcreate --wipesignatures y -n worker_swap_${I} -i $disks_per_instance -L ${OBS_WORKER_SWAP_SIZE}M OBS $DEVS || exit
done
fi

# Create cache partition on remaining space
#lvcreate -n cache -i $disks_per_instance -l 100%FREE OBS || exit
lvcreate -n cache -i $disks_per_instance -L "${OBS_WORKER_CACHE_SIZE}M" OBS || exit
lvcreate --wipesignatures y -n cache -i $disks_per_instance -L "${OBS_WORKER_CACHE_SIZE}M" OBS || exit
mkfs -text4 /dev/OBS/cache || exit
fi
fi
Expand Down Expand Up @@ -398,13 +398,15 @@ case "$1" in
fi
fi

# make sure that directories needed by mostly all other daemons are created now
# and set proper ownership
bsuser=`perl -I/usr/lib/obs/server -MBSConfig -e 'print ( $BSConfig::bsuser || "obsrun" )'`
bsgroup=`perl -I/usr/lib/obs/server -MBSConfig -e 'print ( $BSConfig::bsgroup || "obsrun" )'`
[ -d $backenddir/run ] || mkdir -p $backenddir/run
[ -d $backenddir/log ] || mkdir -p $backenddir/log
chown $bsuser:$bsgroup $backenddir $backenddir/run $backenddir/log
if [ -e /usr/lib/obs/server ]; then
# make sure that directories needed by mostly all other daemons are created now
# and set proper ownership
bsuser=`perl -I/usr/lib/obs/server -MBSConfig -e 'print ( $BSConfig::bsuser || "obsrun" )'`
bsgroup=`perl -I/usr/lib/obs/server -MBSConfig -e 'print ( $BSConfig::bsgroup || "obsrun" )'`
[ -d $backenddir/run ] || mkdir -p $backenddir/run
[ -d $backenddir/log ] || mkdir -p $backenddir/log
chown $bsuser:$bsgroup $backenddir $backenddir/run $backenddir/log
fi

# offer hook to make random special things in your setup
if [ -n "$OBS_WORKER_SCRIPT_URL" ]; then
Expand Down

0 comments on commit 23382bd

Please sign in to comment.