mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-11-07 18:43:41 +08:00
Compare commits
8 Commits
dec2dc9230
...
v7.47
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
433c83b393 | ||
|
|
5577178eeb | ||
|
|
221b0242fa | ||
|
|
c05623f8af | ||
|
|
eb9884cc96 | ||
|
|
8e2490e6bc | ||
|
|
399243886e | ||
|
|
b0dbfcb805 |
@@ -1,9 +1,8 @@
|
|||||||
services:
|
services:
|
||||||
dsm:
|
dsm:
|
||||||
container_name: dsm
|
container_name: dsm
|
||||||
image: vdsm/virtual-dsm
|
image: ghcr.io/vdsm/virtual-dsm
|
||||||
environment:
|
environment:
|
||||||
ALLOCATE: "Y"
|
|
||||||
RAM_SIZE: "half"
|
RAM_SIZE: "half"
|
||||||
DISK_SIZE: "max"
|
DISK_SIZE: "max"
|
||||||
CPU_CORES: "max"
|
CPU_CORES: "max"
|
||||||
|
|||||||
@@ -1,18 +1,17 @@
|
|||||||
{
|
{
|
||||||
"name": "Virtual DSM",
|
"name": "Virtual DSM",
|
||||||
"service": "dsm",
|
"service": "vdsm",
|
||||||
"containerEnv": {
|
|
||||||
"ALLOCATE": "Y"
|
|
||||||
},
|
|
||||||
"forwardPorts": [5000],
|
"forwardPorts": [5000],
|
||||||
"portsAttributes": {
|
"portsAttributes": {
|
||||||
"5000": {
|
"5000": {
|
||||||
"label": "Web",
|
"label": "Web",
|
||||||
"onAutoForward": "openBrowser"
|
"onAutoForward": "notify"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"otherPortsAttributes": {
|
"otherPortsAttributes": {
|
||||||
"onAutoForward": "silent"
|
"onAutoForward": "ignore"
|
||||||
},
|
},
|
||||||
"dockerComposeFile": "codespaces.yml"
|
"dockerComposeFile": "codespaces.yml",
|
||||||
|
"workspaceFolder": "/workspaces/vdsm",
|
||||||
|
"initializeCommand": "docker system prune --all --force"
|
||||||
}
|
}
|
||||||
|
|||||||
13
src/power.sh
13
src/power.sh
@@ -33,6 +33,7 @@ _trap() {
|
|||||||
finish() {
|
finish() {
|
||||||
|
|
||||||
local pid
|
local pid
|
||||||
|
local cnt=0
|
||||||
local reason=$1
|
local reason=$1
|
||||||
|
|
||||||
touch "$QEMU_END"
|
touch "$QEMU_END"
|
||||||
@@ -40,14 +41,24 @@ finish() {
|
|||||||
if [ -s "$QEMU_PID" ]; then
|
if [ -s "$QEMU_PID" ]; then
|
||||||
|
|
||||||
pid=$(<"$QEMU_PID")
|
pid=$(<"$QEMU_PID")
|
||||||
echo && error "Forcefully terminating QEMU process, reason: $reason..."
|
echo && error "Forcefully terminating Virtual DSM, reason: $reason..."
|
||||||
{ kill -15 "$pid" || true; } 2>/dev/null
|
{ kill -15 "$pid" || true; } 2>/dev/null
|
||||||
|
|
||||||
while isAlive "$pid"; do
|
while isAlive "$pid"; do
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
|
cnt=$((cnt+1))
|
||||||
|
|
||||||
# Workaround for zombie pid
|
# Workaround for zombie pid
|
||||||
[ ! -s "$QEMU_PID" ] && break
|
[ ! -s "$QEMU_PID" ] && break
|
||||||
|
|
||||||
|
if [ "$cnt" == "5" ]; then
|
||||||
|
echo && error "QEMU did not terminate itself, forcefully killing process..."
|
||||||
|
{ kill -9 "$pid" || true; } 2>/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fKill "print.sh"
|
fKill "print.sh"
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -Eeuo pipefail
|
set -Eeuo pipefail
|
||||||
|
|
||||||
|
info="/run/shm/msg.html"
|
||||||
|
|
||||||
escape () {
|
escape () {
|
||||||
local s
|
local s
|
||||||
s=${1//&/\&}
|
s=${1//&/\&}
|
||||||
@@ -11,28 +13,33 @@ escape () {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
file="$1"
|
path="$1"
|
||||||
total="$2"
|
total="$2"
|
||||||
body=$(escape "$3")
|
body=$(escape "$3")
|
||||||
info="/run/shm/msg.html"
|
|
||||||
|
|
||||||
if [[ "$body" == *"..." ]]; then
|
if [[ "$body" == *"..." ]]; then
|
||||||
body="<p class=\"loading\">${body/.../}</p>"
|
body="<p class=\"loading\">${body::-3}</p>"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
if [ -s "$file" ]; then
|
|
||||||
bytes=$(du -sb "$file" | cut -f1)
|
if [ ! -s "$path" ] && [ ! -d "$path" ]; then
|
||||||
if (( bytes > 1000 )); then
|
bytes="0"
|
||||||
|
else
|
||||||
|
bytes=$(du -sb "$path" | cut -f1)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if (( bytes > 4096 )); then
|
||||||
if [ -z "$total" ] || [[ "$total" == "0" ]] || [ "$bytes" -gt "$total" ]; then
|
if [ -z "$total" ] || [[ "$total" == "0" ]] || [ "$bytes" -gt "$total" ]; then
|
||||||
size=$(numfmt --to=iec --suffix=B "$bytes" | sed -r 's/([A-Z])/ \1/')
|
size=$(numfmt --to=iec --suffix=B "$bytes" | sed -r 's/([A-Z])/ \1/')
|
||||||
else
|
else
|
||||||
size="$(echo "$bytes" "$total" | awk '{printf "%.1f", $1 * 100 / $2}')"
|
size="$(echo "$bytes" "$total" | awk '{printf "%.1f", $1 * 100 / $2}')"
|
||||||
size="$size%"
|
size="$size%"
|
||||||
fi
|
fi
|
||||||
echo "${body//(\[P\])/($size)}"> "$info"
|
[[ "$size" != "0.0%" ]] && echo "${body//(\[P\])/($size)}"> "$info"
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sleep 1 & wait $!
|
sleep 1 & wait $!
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user