Sync
This commit is contained in:
Kroese 2023-04-29 03:12:08 +02:00 committed by GitHub
commit b14f0cd102
2 changed files with 9 additions and 10 deletions

View file

@ -3,9 +3,10 @@ set -eu
# Docker environment variables # Docker environment variables
: ${DISK_IO:='native'} # I/O Mode, can be set to 'native', 'threads' or 'io_turing' : ${DISK_IO:='native'} # I/O Mode, can be set to 'native', 'threads' or 'io_turing'
: ${DISK_ROTATION:='1'} # Rotation rate, set to 1 for SSD storage and increase for HDD : ${DISK_CACHE:='none'} # Caching mode, can be set to 'writeback' for better performance
: ${DISK_CACHE:='none'} # Caching mode, can be set to 'writeback' for better performance : ${DISK_DISCARD:='on'} # 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
BOOT="$STORAGE/boot.img" BOOT="$STORAGE/boot.img"
[ ! -f "$BOOT" ] && echo "ERROR: Boot image does not exist ($BOOT)" && exit 81 [ ! -f "$BOOT" ] && echo "ERROR: Boot image does not exist ($BOOT)" && exit 81
@ -115,5 +116,5 @@ DISK_OPTS="\
-device virtio-scsi-pci,id=scsi0 \ -device virtio-scsi-pci,id=scsi0 \
-device scsi-cd,bus=scsi0.0,drive=cdrom0 \ -device scsi-cd,bus=scsi0.0,drive=cdrom0 \
-device virtio-scsi-pci,id=hw-userdata,bus=pcie.0,addr=0xa \ -device virtio-scsi-pci,id=hw-userdata,bus=pcie.0,addr=0xa \
-drive file=${DATA},if=none,id=drive-userdata,format=raw,cache=${DISK_CACHE},aio=${DISK_IO},discard=on,detect-zeroes=on \ -drive file=${DATA},if=none,id=drive-userdata,format=raw,cache=${DISK_CACHE},aio=${DISK_IO},discard=${DISK_DISCARD},detect-zeroes=on \
-device scsi-hd,bus=hw-userdata.0,channel=0,scsi-id=0,lun=0,drive=drive-userdata,id=userdata0,rotation_rate=${DISK_ROTATION},bootindex=1" -device scsi-hd,bus=hw-userdata.0,channel=0,scsi-id=0,lun=0,drive=drive-userdata,id=userdata0,rotation_rate=${DISK_ROTATION},bootindex=1"

View file

@ -21,13 +21,12 @@ _trap(){
_graceful_shutdown() { _graceful_shutdown() {
set +e
[ ! -f "${_QEMU_PID}" ] && return [ ! -f "${_QEMU_PID}" ] && return
[ -f "${_QEMU_SHUTDOWN_COUNTER}" ] && return [ -f "${_QEMU_SHUTDOWN_COUNTER}" ] && return
set +e echo && echo "Received $1 signal, shutting down..."
echo
echo "Received $1 signal, shutting down..."
echo 0 > "${_QEMU_SHUTDOWN_COUNTER}" echo 0 > "${_QEMU_SHUTDOWN_COUNTER}"
# Send the shutdown (system_powerdown) command to the QMP monitor # Send the shutdown (system_powerdown) command to the QMP monitor
@ -48,8 +47,7 @@ _graceful_shutdown() {
done done
echo echo && echo "Quitting..."
echo "Quitting..."
echo 'quit' | nc -q 1 -w 1 localhost "${QEMU_MONPORT}" > /dev/null || true echo 'quit' | nc -q 1 -w 1 localhost "${QEMU_MONPORT}" > /dev/null || true
return return