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

From 0dfd007dc2d515cac302a2480088bfd6b32b8b5c 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 7d991ba72f..2719bc3cbe 100755
--- a/dist/obsworker
+++ b/dist/obsworker
@@ -466,6 +466,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.31.1