File obs-server-2.9-0021-dist-Allow-worker-to-use-tmpfs-for-other-virtualisat.patch of Package obs-server

From c1e538e95d78c1838f60431b6b12ddc4b4aa9cbf Mon Sep 17 00:00:00 2001
From: Oleg Girko <ol@infoserver.lv>
Date: Wed, 31 Aug 2016 03:57:30 +0100
Subject: [PATCH] [dist] Allow worker to use tmpfs for other virtualisation
 methods.

This change makes worker startup script to pass --tmpfs parameter
to bs_worker when using other virtualisation methods besides xen and kvm
wnen OBS_VM_USE_TMPFS configuration variable is set.
This allows to speed up lxc and even chroot builds.

The OBS_VM_DISK_AUTOSETUP_ROOT_FILESIZE configuration variable
is also regarded and passed as a value of --vmdisk-rootsize option
allowing to limit maximum size of tmpfs.

Signed-off-by: Oleg Girko <ol@infoserver.lv>
---
 dist/obsworker | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/dist/obsworker b/dist/obsworker
index 26cc84f413..65344c788a 100755
--- a/dist/obsworker
+++ b/dist/obsworker
@@ -465,6 +465,12 @@ case "$1" in
 		WORKER_NR="--vm-worker-nr $I"
 		OBS_WORKER_OPT="$OBS_WORKER_OPT1 $WORKER $WORKER_NR $VMDISK_FILESYSTEM $VMDISK_MOUNT_OPTIONS $VMDISK_CLEAN"
             else
+                if [ -n "$OBS_VM_USE_TMPFS" ]; then
+                    TMPFS="--tmpfs"
+                    if [ -n "$OBS_VM_DISK_AUTOSETUP_ROOT_FILESIZE" ]; then
+                        TMPFS="$TMPFS --vmdisk-rootsize ${OBS_VM_DISK_AUTOSETUP_ROOT_FILESIZE}"
+                    fi
+                fi
                 mkdir -p $R
                 DEVICE=
                 SWAP=
-- 
2.20.1