summaryrefslogtreecommitdiffstats
path: root/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/init_core.inc
blob: 97d08440e02a9a32ba6cf162d6fa98fb6e852e4a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
################################################
# Include: Sets core variables and directories #
################################################

# Create temporary directory for current invocation
if check_dep mkdir && ! mkdir -p "$TMPDIR" "$CONFDIR"; then
	writelog "Could not create temporary directories for session"
	EXIT_TYPE="internal" EXIT_REASON="Konnte kein Arbeitsverzeichnis für die VM-Sitzung anlegen." cleanexit 1
fi

# Check that /tmp/virt is not in RAM.
# Either mounted directly (e.g. NFS) or backed by hdd mounted /tmp.
# This variable will be true or false
declare -g TMPDIR_IN_RAM=false
if fs_path_isvolatile /tmp/virt ; then
	TMPDIR_IN_RAM=true
	writelog "/tmp/virt is in RAM, will allocate little RAM to VMs."
else
	writelog "/tmp/virt is not in RAM, will allocate more RAM to VMs."
fi
readonly TMPDIR_IN_RAM

# Get a unique VM_ID for the current invocation
get_vm_id