mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2026-08-29 04:07:02 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3c7c3ca1b1 | ||
|
|
2b27f32cd4 | ||
|
|
55d1d50284 | ||
|
|
784b73b5b5 | ||
|
|
85f00bb9cc | ||
|
|
efe8732e47 | ||
|
|
f6871dd61b | ||
|
|
a713b728ff | ||
|
|
0d74c6ac80 |
@@ -1,4 +1,5 @@
|
||||
version: 2
|
||||
|
||||
updates:
|
||||
- package-ecosystem: docker
|
||||
directory: /
|
||||
@@ -6,9 +7,15 @@ updates:
|
||||
interval: weekly
|
||||
cooldown:
|
||||
default-days: 7
|
||||
|
||||
- package-ecosystem: github-actions
|
||||
directory: /
|
||||
schedule:
|
||||
interval: weekly
|
||||
cooldown:
|
||||
default-days: 7
|
||||
ignore:
|
||||
- dependency-name: "*"
|
||||
update-types:
|
||||
- version-update:semver-minor
|
||||
- version-update:semver-patch
|
||||
|
||||
@@ -39,6 +39,7 @@ An empty default means the variable is unset and its value is determined automat
|
||||
| `DISK_DISCARD` | `unmap` | Discard/TRIM mode for the primary disk. |
|
||||
| `DISK_ROTATION` | `1` | Rotation rate reported to the guest. Use `1` to identify the disk as an SSD. |
|
||||
| `DISK_FLAGS` | | Additional options used when creating `qcow2` disks. |
|
||||
| `DISK_OPTIONS` | | Additional options appended to QEMU disk devices. |
|
||||
| `ALLOCATE` | `N` | Preallocates space for the data disks. |
|
||||
| `STORAGE` | `/storage` | Storage directory used for disks, settings, and downloads. |
|
||||
|
||||
|
||||
+15
-5
@@ -7,6 +7,7 @@ set -Eeuo pipefail
|
||||
: "${DISK_FMT:="raw"}" # Disk file format, 'raw' by default for best performance
|
||||
: "${DISK_TYPE:=""}" # Device type to be used, "sata", "nvme", "blk" or "scsi"
|
||||
: "${DISK_FLAGS:=""}" # Specifies the options for use with the qcow2 disk format
|
||||
: "${DISK_OPTIONS:=""}" # Specifies additional options for the QEMU disk device
|
||||
: "${DISK_CACHE:="none"}" # Caching mode, can be set to 'writeback' for better performance
|
||||
: "${DISK_DISCARD:="unmap"}" # Controls whether unmap (TRIM) commands are passed to the host.
|
||||
: "${DISK_ROTATION:="1"}" # Rotation rate, set to 1 for SSD storage and increase for HDD
|
||||
@@ -16,6 +17,7 @@ DISK_IO=$(strip "$DISK_IO")
|
||||
DISK_FMT=$(strip "$DISK_FMT")
|
||||
DISK_TYPE=$(strip "$DISK_TYPE")
|
||||
DISK_FLAGS=$(strip "$DISK_FLAGS")
|
||||
DISK_OPTIONS=$(strip "$DISK_OPTIONS")
|
||||
DISK_CACHE=$(strip "$DISK_CACHE")
|
||||
DISK_DISCARD=$(strip "$DISK_DISCARD")
|
||||
DISK_ROTATION=$(strip "$DISK_ROTATION")
|
||||
@@ -508,6 +510,9 @@ createDevice () {
|
||||
|
||||
[[ -z "${PCI_BUS:-}" && ( "${MACHINE,,}" == pc || "${MACHINE,,}" == pc-i440fx* ) ]] && bus="pci.0"
|
||||
|
||||
local options=""
|
||||
[ -n "$DISK_OPTIONS" ] && options=",${DISK_OPTIONS#,}"
|
||||
|
||||
local bootIndex=""
|
||||
local diskId="data$diskIndex"
|
||||
[ -n "$diskIndex" ] && bootIndex=",bootindex=$diskIndex"
|
||||
@@ -520,29 +525,29 @@ createDevice () {
|
||||
;;
|
||||
"usb" )
|
||||
result+=",if=none \
|
||||
-device usb-storage,drive=${diskId}${bootIndex}${diskSerial}${diskSectors}"
|
||||
-device usb-storage,drive=${diskId}${bootIndex}${diskSerial}${diskSectors}${options}"
|
||||
echo "$result"
|
||||
;;
|
||||
"nvme" )
|
||||
result+=",if=none \
|
||||
-device nvme,drive=${diskId}${bootIndex},serial=deadbeaf${diskIndex}${diskSerial}${diskSectors}"
|
||||
-device nvme,drive=${diskId}${bootIndex},serial=deadbeaf${diskIndex}${diskSerial}${diskSectors}${options}"
|
||||
echo "$result"
|
||||
;;
|
||||
"ide" | "sata" )
|
||||
result+=",if=none \
|
||||
-device ich9-ahci,id=ahci${diskIndex},addr=$diskAddress \
|
||||
-device ide-hd,drive=${diskId},bus=ahci$diskIndex.0,rotation_rate=$DISK_ROTATION${bootIndex}${diskSerial}${diskSectors}"
|
||||
-device ide-hd,drive=${diskId},bus=ahci$diskIndex.0,rotation_rate=$DISK_ROTATION${bootIndex}${diskSerial}${diskSectors}${options}"
|
||||
echo "$result"
|
||||
;;
|
||||
"blk" | "virtio-blk" )
|
||||
result+=",if=none \
|
||||
-device virtio-blk-pci,drive=${diskId},bus=$bus,addr=$diskAddress,iothread=io2${bootIndex}${diskSerial}${diskSectors}"
|
||||
-device virtio-blk-pci,drive=${diskId},bus=$bus,addr=$diskAddress,iothread=io2${bootIndex}${diskSerial}${diskSectors}${options}"
|
||||
echo "$result"
|
||||
;;
|
||||
"scsi" | "virtio-scsi" )
|
||||
result+=",if=none \
|
||||
-device virtio-scsi-pci,id=${diskId}b,bus=$bus,addr=$diskAddress,iothread=io2,hotplug=off \
|
||||
-device scsi-hd,drive=${diskId},bus=${diskId}b.0,channel=0,scsi-id=0,lun=0,rotation_rate=$DISK_ROTATION${bootIndex}${diskSerial}${diskSectors}"
|
||||
-device scsi-hd,drive=${diskId},bus=${diskId}b.0,channel=0,scsi-id=0,lun=0,rotation_rate=$DISK_ROTATION${bootIndex}${diskSerial}${diskSectors}${options}"
|
||||
echo "$result"
|
||||
;;
|
||||
esac
|
||||
@@ -771,6 +776,11 @@ if [[ "$DISK_FLAGS" =~ [[:space:]] ]]; then
|
||||
exit 78
|
||||
fi
|
||||
|
||||
if [[ "$DISK_OPTIONS" =~ [[:space:]] ]]; then
|
||||
error "Invalid DISK_OPTIONS value '$DISK_OPTIONS', spaces are not allowed."
|
||||
exit 78
|
||||
fi
|
||||
|
||||
if [ -z "$ALLOCATE" ]; then
|
||||
ALLOCATE="N"
|
||||
fi
|
||||
|
||||
+5
-1
@@ -449,6 +449,7 @@ configureDNS() {
|
||||
local gateway="$6"
|
||||
local upstream="${7:-}"
|
||||
local arguments="$DNSMASQ_OPTS"
|
||||
local pid
|
||||
|
||||
if ! echo "$gateway" > /run/shm/qemu.gw; then
|
||||
error "Failed to write gateway file."
|
||||
@@ -458,7 +459,10 @@ configureDNS() {
|
||||
enabled "${DNSMASQ_DISABLE:-}" && return 0
|
||||
enabled "$DEBUG" && echo "Starting dnsmasq daemon..."
|
||||
|
||||
[ -s "$DNSMASQ_PID" ] && pKill "$(<"$DNSMASQ_PID")"
|
||||
if readPidFile pid "$DNSMASQ_PID"; then
|
||||
pKill "$pid"
|
||||
fi
|
||||
|
||||
rm -f "$DNSMASQ_PID"
|
||||
|
||||
if isNAT; then
|
||||
|
||||
+4
-14
@@ -67,16 +67,8 @@ displayReason() {
|
||||
|
||||
readQemuPid() {
|
||||
|
||||
local -n _pid="$1"
|
||||
local file
|
||||
|
||||
for file in "$QEMU_START_PID" "$QEMU_PID"; do
|
||||
if [ -s "$file" ] && read -r _pid < "$file"; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
return 1
|
||||
readPidFile "$1" "$QEMU_START_PID" && return 0
|
||||
readPidFile "$1" "$QEMU_PID"
|
||||
}
|
||||
|
||||
qemuPidFile() {
|
||||
@@ -100,16 +92,14 @@ waitQemuExit() {
|
||||
|
||||
waitQemuPid() {
|
||||
|
||||
local -n _pid="$1"
|
||||
local cnt=0 value
|
||||
local cnt=0
|
||||
|
||||
while ! readQemuPid value; do
|
||||
while ! readQemuPid "$1"; do
|
||||
sleep 0.02
|
||||
cnt=$((cnt + 1))
|
||||
(( cnt >= 50 )) && return 1
|
||||
done
|
||||
|
||||
_pid="$value"
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -73,7 +73,7 @@ startHostBinary() {
|
||||
pid=$!
|
||||
fi
|
||||
|
||||
echo "$pid" > "$HOST_PID"
|
||||
printf '%s\n' "$pid" > "$HOST_PID"
|
||||
|
||||
return 0
|
||||
}
|
||||
@@ -86,7 +86,7 @@ waitForSocket() {
|
||||
|
||||
while [ ! -S "$socket" ]; do
|
||||
|
||||
if ! read -r pid < "$HOST_PID" || ! isAlive "$pid"; then
|
||||
if ! readPidFile pid "$HOST_PID" || ! isAlive "$pid"; then
|
||||
error "qemu-host exited unexpectedly!"
|
||||
exit "$exit_code"
|
||||
fi
|
||||
|
||||
+2
-2
@@ -64,7 +64,7 @@ stopWebServer() {
|
||||
|
||||
local pid
|
||||
|
||||
if [ -s "$WEB_PID" ] && read -r pid < "$WEB_PID" && [ -n "$pid" ]; then
|
||||
if readPidFile pid "$WEB_PID"; then
|
||||
pKill "$pid" 2
|
||||
|
||||
if isAlive "$pid"; then
|
||||
@@ -88,7 +88,7 @@ stopWebsocketServer() {
|
||||
|
||||
local pid
|
||||
|
||||
if [ -s "$WSD_PID" ] && read -r pid < "$WSD_PID" && [ -n "$pid" ]; then
|
||||
if readPidFile pid "$WSD_PID"; then
|
||||
pKill "$pid" 2
|
||||
|
||||
if isAlive "$pid"; then
|
||||
|
||||
+20
-6
@@ -7,6 +7,24 @@ info () { printf "%b%s%b" "\E[1;34m❯ \E[1;36m" "${1:-}" "\E[0m\n"; }
|
||||
error () { printf "%b%s%b" "\E[1;31m❯ " "ERROR: ${1:-}" "\E[0m\n" >&2; }
|
||||
warn () { printf "%b%s%b" "\E[1;31m❯ " "Warning: ${1:-}" "\E[0m\n" >&2; }
|
||||
|
||||
readPidFile() {
|
||||
|
||||
local -n _pid="$1"
|
||||
_pid=""
|
||||
|
||||
if ! _pid=$(cat -- "$2" 2>/dev/null); then
|
||||
_pid=""
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ ! "$_pid" =~ ^[1-9][0-9]*$ ]]; then
|
||||
_pid=""
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
hasFlag() {
|
||||
|
||||
# Match a whitespace-delimited token in /proc/cpuinfo
|
||||
@@ -137,9 +155,7 @@ waitPidFile() {
|
||||
local file="$1"
|
||||
local timeout="${2:-10}"
|
||||
|
||||
[ ! -s "$file" ] && return 0
|
||||
! read -r pid <"$file" && return 0
|
||||
[ -z "$pid" ] && return 0
|
||||
! readPidFile pid "$file" && return 0
|
||||
|
||||
while [ -s "$file" ] && isAlive "$pid"; do
|
||||
sleep 0.2
|
||||
@@ -203,9 +219,7 @@ sKill() {
|
||||
local pid
|
||||
local file="$1"
|
||||
|
||||
[ ! -s "$file" ] && return 0
|
||||
! read -r pid <"$file" && return 0
|
||||
[ -z "$pid" ] && return 0
|
||||
! readPidFile pid "$file" && return 0
|
||||
|
||||
if isAlive "$pid"; then
|
||||
{ kill -15 -- "$pid" || :; } 2>/dev/null
|
||||
|
||||
+10
-3
@@ -71,6 +71,13 @@ function processInfo() {
|
||||
var response = request;
|
||||
request = null;
|
||||
|
||||
var status = response.status;
|
||||
|
||||
if (status == 502 || status == 503 || status == 504) {
|
||||
schedule();
|
||||
return true;
|
||||
}
|
||||
|
||||
var msg = response.responseText;
|
||||
if (msg == null || msg.length == 0) {
|
||||
|
||||
@@ -83,9 +90,9 @@ function processInfo() {
|
||||
return false;
|
||||
}
|
||||
|
||||
var notFound = (response.status == 404);
|
||||
var notFound = (status == 404);
|
||||
|
||||
if (response.status == 200) {
|
||||
if (status == 200) {
|
||||
if (msg.toLowerCase().indexOf("<html>") !== -1) {
|
||||
notFound = true;
|
||||
} else {
|
||||
@@ -103,7 +110,7 @@ function processInfo() {
|
||||
return true;
|
||||
}
|
||||
|
||||
setError("Error: Received statuscode " + response.status);
|
||||
setError("Error: Received statuscode " + status);
|
||||
return false;
|
||||
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user