mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-11-09 03:23:40 +08:00
Compare commits
3 Commits
dff8abbe1e
...
v7.46
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c44669d91 | ||
|
|
175d90aad7 | ||
|
|
e1e5f8f91d |
@@ -3,7 +3,8 @@ services:
|
|||||||
container_name: dsm
|
container_name: dsm
|
||||||
image: vdsm/virtual-dsm
|
image: vdsm/virtual-dsm
|
||||||
environment:
|
environment:
|
||||||
RAM_SIZE: "max"
|
ALLOCATE: "Y"
|
||||||
|
RAM_SIZE: "half"
|
||||||
DISK_SIZE: "max"
|
DISK_SIZE: "max"
|
||||||
CPU_CORES: "max"
|
CPU_CORES: "max"
|
||||||
devices:
|
devices:
|
||||||
|
|||||||
@@ -2,9 +2,7 @@
|
|||||||
"name": "Virtual DSM",
|
"name": "Virtual DSM",
|
||||||
"service": "dsm",
|
"service": "dsm",
|
||||||
"containerEnv": {
|
"containerEnv": {
|
||||||
"RAM_SIZE": "max",
|
"ALLOCATE": "Y"
|
||||||
"DISK_SIZE": "max",
|
|
||||||
"CPU_CORES": "max"
|
|
||||||
},
|
},
|
||||||
"forwardPorts": [5000],
|
"forwardPorts": [5000],
|
||||||
"portsAttributes": {
|
"portsAttributes": {
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ cd /run
|
|||||||
. proc.sh # Initialize processor
|
. proc.sh # Initialize processor
|
||||||
. serial.sh # Initialize serialport
|
. serial.sh # Initialize serialport
|
||||||
. power.sh # Configure shutdown
|
. power.sh # Configure shutdown
|
||||||
. config.sh # Configure arguments
|
|
||||||
. memory.sh # Check available memory
|
. memory.sh # Check available memory
|
||||||
|
. config.sh # Configure arguments
|
||||||
. finish.sh # Finish initialization
|
. finish.sh # Finish initialization
|
||||||
|
|
||||||
trap - ERR
|
trap - ERR
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
set -Eeuo pipefail
|
set -Eeuo pipefail
|
||||||
|
|
||||||
RAM_AVAIL=$(free -b | grep -m 1 Mem: | awk '{print $7}')
|
RAM_AVAIL=$(free -b | grep -m 1 Mem: | awk '{print $7}')
|
||||||
|
|
||||||
if [[ "$RAM_CHECK" != [Nn]* && "${RAM_SIZE,,}" != "max" && "${RAM_SIZE,,}" != "half" ]]; then
|
if [[ "$RAM_CHECK" != [Nn]* && "${RAM_SIZE,,}" != "max" && "${RAM_SIZE,,}" != "half" ]]; then
|
||||||
|
|
||||||
AVAIL_MEM=$(formatBytes "$RAM_AVAIL")
|
AVAIL_MEM=$(formatBytes "$RAM_AVAIL")
|
||||||
@@ -59,15 +59,15 @@ if [[ "${RAM_SIZE,,}" == "max" ]]; then
|
|||||||
RAM_WANTED=$(( RAM_WANTED / 1073741825 ))
|
RAM_WANTED=$(( RAM_WANTED / 1073741825 ))
|
||||||
|
|
||||||
if (( "$RAM_WANTED" < 1 )); then
|
if (( "$RAM_WANTED" < 1 )); then
|
||||||
|
|
||||||
RAM_WANTED=$(( RAM_AVAIL - RAM_SPARE ))
|
RAM_WANTED=$(( RAM_AVAIL - RAM_SPARE ))
|
||||||
RAM_WANTED=$(( RAM_WANTED / 1048577 ))
|
RAM_WANTED=$(( RAM_WANTED / 1048577 ))
|
||||||
|
|
||||||
if (( "$RAM_WANTED" < 1 )); then
|
if (( "$RAM_WANTED" < 1 )); then
|
||||||
|
|
||||||
RAM_WANTED=$(( RAM_AVAIL ))
|
RAM_WANTED=$(( RAM_AVAIL ))
|
||||||
RAM_WANTED=$(( RAM_WANTED / 1048577 ))
|
RAM_WANTED=$(( RAM_WANTED / 1048577 ))
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
RAM_SIZE="${RAM_WANTED}M"
|
RAM_SIZE="${RAM_WANTED}M"
|
||||||
@@ -80,7 +80,7 @@ if [[ "${RAM_SIZE,,}" == "max" ]]; then
|
|||||||
else
|
else
|
||||||
RAM_SIZE="${RAM_WANTED}G"
|
RAM_SIZE="${RAM_WANTED}G"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@@ -1,16 +1,31 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -Eeuo pipefail
|
set -Eeuo pipefail
|
||||||
|
|
||||||
|
lastmsg=""
|
||||||
path="/run/shm/msg.html"
|
path="/run/shm/msg.html"
|
||||||
|
|
||||||
if [ -f "$path" ] && [ -s "$path" ]; then
|
refresh() {
|
||||||
echo -n "s: " && cat "$path"
|
|
||||||
fi
|
[ ! -f "$path" ] && return 0
|
||||||
|
[ ! -s "$path" ] && return 0
|
||||||
|
|
||||||
|
msg=$(< "$path")
|
||||||
|
msg="${msg%$'\n'}"
|
||||||
|
|
||||||
|
[ -z "$msg" ] && return 0
|
||||||
|
[[ "$msg" == "$lastmsg" ]] && return 0
|
||||||
|
|
||||||
|
lastmsg="$msg"
|
||||||
|
echo "s: $msg"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
refresh
|
||||||
|
|
||||||
inotifywait -m "$path" |
|
inotifywait -m "$path" |
|
||||||
while read -r fp event fn; do
|
while read -r fp event fn; do
|
||||||
case "${event,,}" in
|
case "${event,,}" in
|
||||||
"modify"* ) echo -n "s: " && cat "$path" ;;
|
"modify"* ) refresh ;;
|
||||||
"delete_self" ) echo "c: vnc" ;;
|
"delete_self" ) echo "c: vnc" ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user