summaryrefslogtreecommitdiffstats
path: root/core/modules/run-virt/data/opt/openslx/system-check/hooks.d/30-run-virt
blob: 27d85164079c7f68e1ca694ed05ef5e7788f4d48 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/ash

. /opt/openslx/config
. /opt/openslx/bin/slx-tools
. /run/hwinfo

if [ -n "$1" ]; then
	exec >> "$1"
fi

if [ "$HW_KVM" = "DISABLED" ]; then
	echo 'slx-virt-kvm-disabled'
elif [ "$HW_KVM" = "UNSUPPORTED" ]; then
	echo 'slx-virt-kvm-unsupported'
fi

if [ -n "$HW_MBRAM" ] && [ "$HW_MBRAM" -lt 3400 ]; then
	GB=$(( ( HW_MBRAM + 300 ) / 1024 ))
	echo "slx-virt-lowmemory|${GB}"
fi

if [ -n "$SLX_VM_NFS" ] && systemctl is-failed mount-vm-store.service --quiet; then
	echo 'slx-virt-vmstore-fail'
fi

# Jambo-specific: They mount an NFS share here, so no ID44 doesn't matter
if fs_path_ismountpoint /tmp/virt; then
	exit 0
fi

if [ "$HW_ID44" = "0" ]; then
	echo 'slx-virt-noid44'
	if [ "$HW_HDDCOUNT" = "0" ]; then
		echo 'slx-virt-noid44-nohdd'
	elif [ -n "$HW_HDDCOUNT" ]; then
		echo 'slx-virt-noid44-hdd'
	fi
	if [ -n "$HW_MBRAM" ] && [ "$HW_MBRAM" -lt 4500 ]; then
		echo 'slx-virt-noid44-lowmemory'
	fi
elif [ -n "$HW_ID44" ] && [ "$HW_ID44" -lt 10000 ]; then
	echo 'slx-virt-id44-small'
fi