mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-02-24 13:30:02 +08:00
feat: Multiple disk support
feat: Multiple disk support
This commit is contained in:
commit
9c6aeca709
2
.github/workflows/check.yml
vendored
2
.github/workflows/check.yml
vendored
@ -11,4 +11,4 @@ jobs:
|
|||||||
- name: Run ShellCheck
|
- name: Run ShellCheck
|
||||||
uses: ludeeus/action-shellcheck@master
|
uses: ludeeus/action-shellcheck@master
|
||||||
env:
|
env:
|
||||||
SHELLCHECK_OPTS: -x -e SC2001 -e SC2002 -e SC2223 -e SC2034 -e SC2064 -e SC2317 -e SC2028
|
SHELLCHECK_OPTS: -x -e SC2001 -e SC2002 -e SC2223 -e SC2034 -e SC2064 -e SC2317 -e SC2028 -e SC2153
|
||||||
|
@ -16,6 +16,7 @@ RUN apt-get update && apt-get -y upgrade && \
|
|||||||
apt-get --no-install-recommends -y install \
|
apt-get --no-install-recommends -y install \
|
||||||
curl \
|
curl \
|
||||||
cpio \
|
cpio \
|
||||||
|
tini \
|
||||||
wget \
|
wget \
|
||||||
fdisk \
|
fdisk \
|
||||||
unzip \
|
unzip \
|
||||||
@ -64,4 +65,4 @@ LABEL org.opencontainers.image.url=https://hub.docker.com/r/kroese/virtual-dsm/
|
|||||||
|
|
||||||
HEALTHCHECK --interval=60s --retries=2 CMD /run/check.sh
|
HEALTHCHECK --interval=60s --retries=2 CMD /run/check.sh
|
||||||
|
|
||||||
ENTRYPOINT ["/run/run.sh"]
|
ENTRYPOINT ["/usr/bin/tini", "-s", "/run/run.sh"]
|
||||||
|
@ -181,8 +181,6 @@ docker run -it --rm -p 5000:5000 --device=/dev/kvm --cap-add NET_ADMIN --stop-ti
|
|||||||
- /dev/dri
|
- /dev/dri
|
||||||
```
|
```
|
||||||
|
|
||||||
As the Intel GPU drivers will be downloaded during installation, you need to re-install DSM when you want to apply this to an existing instance.
|
|
||||||
|
|
||||||
* ### What are the differences compared to the standard DSM?
|
* ### What are the differences compared to the standard DSM?
|
||||||
|
|
||||||
There are only two minor differences: the Virtual Machine Manager package is not provided, and Surveillance Station doesn't include any free licenses.
|
There are only two minor differences: the Virtual Machine Manager package is not provided, and Surveillance Station doesn't include any free licenses.
|
||||||
|
24
run/disk.sh
24
run/disk.sh
@ -153,3 +153,27 @@ DISK_OPTS="\
|
|||||||
-device virtio-scsi-pci,id=hw-userdata,bus=pcie.0,addr=0xc \
|
-device virtio-scsi-pci,id=hw-userdata,bus=pcie.0,addr=0xc \
|
||||||
-drive file=${DATA},if=none,id=drive-userdata,format=raw,cache=${DISK_CACHE},aio=${DISK_IO},discard=${DISK_DISCARD},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=3"
|
-device scsi-hd,bus=hw-userdata.0,channel=0,scsi-id=0,lun=0,drive=drive-userdata,id=userdata0,rotation_rate=${DISK_ROTATION},bootindex=3"
|
||||||
|
|
||||||
|
STORAGE2="/storage2"
|
||||||
|
DATA2="${STORAGE2}/data.img"
|
||||||
|
|
||||||
|
if [ -f "${DATA2}" ]; then
|
||||||
|
|
||||||
|
DISK_OPTS="${DISK_OPTS} \
|
||||||
|
-device virtio-scsi-pci,id=hw-userdata2,bus=pcie.0,addr=0xd \
|
||||||
|
-drive file=${DATA2},if=none,id=drive-userdata2,format=raw,cache=${DISK_CACHE},aio=${DISK_IO},discard=${DISK_DISCARD},detect-zeroes=on \
|
||||||
|
-device scsi-hd,bus=hw-userdata2.0,channel=0,scsi-id=0,lun=0,drive=drive-userdata2,id=userdata2,rotation_rate=${DISK_ROTATION},bootindex=4"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
STORAGE3="/storage3"
|
||||||
|
DATA3="${STORAGE3}/data.img"
|
||||||
|
|
||||||
|
if [ -f "${DATA3}" ]; then
|
||||||
|
|
||||||
|
DISK_OPTS="${DISK_OPTS} \
|
||||||
|
-device virtio-scsi-pci,id=hw-userdata3,bus=pcie.0,addr=0xe \
|
||||||
|
-drive file=${DATA3},if=none,id=drive-userdata3,format=raw,cache=${DISK_CACHE},aio=${DISK_IO},discard=${DISK_DISCARD},detect-zeroes=on \
|
||||||
|
-device scsi-hd,bus=hw-userdata3.0,channel=0,scsi-id=0,lun=0,drive=drive-userdata3,id=userdata3,rotation_rate=${DISK_ROTATION},bootindex=5"
|
||||||
|
|
||||||
|
fi
|
||||||
|
30
run/gpu.sh
Normal file
30
run/gpu.sh
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -Eeuo pipefail
|
||||||
|
|
||||||
|
[ ! -d /dev/dri ] && mkdir -m 755 /dev/dri
|
||||||
|
|
||||||
|
if [ ! -c /dev/dri/card0 ]; then
|
||||||
|
mknod /dev/dri/card0 c 226 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -c /dev/dri/renderD128 ]; then
|
||||||
|
mknod /dev/dri/renderD128 c 226 128
|
||||||
|
fi
|
||||||
|
|
||||||
|
chmod 666 /dev/dri/card0
|
||||||
|
chmod 666 /dev/dri/renderD128
|
||||||
|
|
||||||
|
DEF_OPTS="-nodefaults -boot strict=on -display egl-headless,rendernode=/dev/dri/renderD128"
|
||||||
|
DEF_OPTS="${DEF_OPTS} -device virtio-vga,id=video0,max_outputs=1,bus=pcie.0,addr=0x1"
|
||||||
|
|
||||||
|
if ! apt-mark showinstall | grep -q "xserver-xorg-video-intel"; then
|
||||||
|
|
||||||
|
info "Installing GPU drivers..."
|
||||||
|
|
||||||
|
export DEBCONF_NOWARNINGS="yes"
|
||||||
|
export DEBIAN_FRONTEND="noninteractive"
|
||||||
|
|
||||||
|
apt-get -qq update
|
||||||
|
apt-get -qq --no-install-recommends -y install xserver-xorg-video-intel > /dev/null
|
||||||
|
|
||||||
|
fi
|
@ -134,27 +134,18 @@ if { tar tf "$PAT"; } >/dev/null 2>&1; then
|
|||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
export DEBCONF_NOWARNINGS="yes"
|
|
||||||
export DEBIAN_FRONTEND="noninteractive"
|
|
||||||
|
|
||||||
if [ "$ARCH" != "amd64" ]; then
|
if [ "$ARCH" != "amd64" ]; then
|
||||||
|
|
||||||
info "Install: Installing QEMU..."
|
info "Install: Installing QEMU..."
|
||||||
|
|
||||||
apt-get -qq update && apt-get -qq -y upgrade
|
export DEBCONF_NOWARNINGS="yes"
|
||||||
|
export DEBIAN_FRONTEND="noninteractive"
|
||||||
|
|
||||||
|
apt-get -qq update
|
||||||
apt-get -qq --no-install-recommends -y install qemu-user > /dev/null
|
apt-get -qq --no-install-recommends -y install qemu-user > /dev/null
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${GPU}" == [Yy1]* ]] && [[ "$ARCH" == "amd64" ]]; then
|
|
||||||
|
|
||||||
info "Install: Installing GPU drivers..."
|
|
||||||
|
|
||||||
apt-get -qq update && apt-get -qq -y upgrade
|
|
||||||
apt-get -qq --no-install-recommends -y install xserver-xorg-video-intel > /dev/null
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
info "Install: Extracting downloaded image..."
|
info "Install: Extracting downloaded image..."
|
||||||
|
|
||||||
export LD_LIBRARY_PATH="/run/extract"
|
export LD_LIBRARY_PATH="/run/extract"
|
||||||
|
22
run/run.sh
22
run/run.sh
@ -5,7 +5,7 @@ set -Eeuo pipefail
|
|||||||
|
|
||||||
: ${URL:=''} # URL of the PAT file
|
: ${URL:=''} # URL of the PAT file
|
||||||
: ${GPU:='N'} # Enable GPU passthrough
|
: ${GPU:='N'} # Enable GPU passthrough
|
||||||
: ${DEBUG:='N'} # Enable debug mode
|
: ${DEBUG:='N'} # Enable debugging mode
|
||||||
: ${ALLOCATE:='Y'} # Preallocate diskspace
|
: ${ALLOCATE:='Y'} # Preallocate diskspace
|
||||||
: ${ARGUMENTS:=''} # Extra QEMU parameters
|
: ${ARGUMENTS:=''} # Extra QEMU parameters
|
||||||
: ${CPU_CORES:='1'} # Amount of CPU cores
|
: ${CPU_CORES:='1'} # Amount of CPU cores
|
||||||
@ -42,17 +42,10 @@ if [[ ! -f "$STORAGE/$BASE.boot.img" ]] || [[ ! -f "$STORAGE/$BASE.system.img" ]
|
|||||||
. /run/install.sh
|
. /run/install.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Initialize disks
|
. /run/disk.sh # Initialize disks
|
||||||
. /run/disk.sh
|
. /run/network.sh # Initialize network
|
||||||
|
. /run/serial.sh # Initialize serialport
|
||||||
# Initialize network
|
. /run/power.sh # Configure shutdown
|
||||||
. /run/network.sh
|
|
||||||
|
|
||||||
# Initialize serialport
|
|
||||||
. /run/serial.sh
|
|
||||||
|
|
||||||
# Configure shutdown
|
|
||||||
. /run/power.sh
|
|
||||||
|
|
||||||
KVM_ERR=""
|
KVM_ERR=""
|
||||||
KVM_OPTS=""
|
KVM_OPTS=""
|
||||||
@ -82,10 +75,7 @@ EXTRA_OPTS="-device virtio-balloon-pci,id=balloon0,bus=pcie.0,addr=0x4"
|
|||||||
EXTRA_OPTS="$EXTRA_OPTS -object rng-random,id=objrng0,filename=/dev/urandom"
|
EXTRA_OPTS="$EXTRA_OPTS -object rng-random,id=objrng0,filename=/dev/urandom"
|
||||||
EXTRA_OPTS="$EXTRA_OPTS -device virtio-rng-pci,rng=objrng0,id=rng0,bus=pcie.0,addr=0x1c"
|
EXTRA_OPTS="$EXTRA_OPTS -device virtio-rng-pci,rng=objrng0,id=rng0,bus=pcie.0,addr=0x1c"
|
||||||
|
|
||||||
if [[ "${GPU}" == [Yy1]* ]]; then
|
[[ "${GPU}" == [Yy1]* ]] && [[ "$ARCH" == "amd64" ]] && . /run/gpu.sh
|
||||||
DEF_OPTS="-nodefaults -boot strict=on -display egl-headless,rendernode=/dev/dri/renderD128"
|
|
||||||
DEF_OPTS="${DEF_OPTS} -device virtio-vga,id=video0,max_outputs=1,bus=pcie.0,addr=0x1"
|
|
||||||
fi
|
|
||||||
|
|
||||||
ARGS="${DEF_OPTS} ${CPU_OPTS} ${RAM_OPTS} ${MAC_OPTS} ${MON_OPTS} ${SERIAL_OPTS} ${NET_OPTS} ${DISK_OPTS} ${EXTRA_OPTS} ${ARGUMENTS}"
|
ARGS="${DEF_OPTS} ${CPU_OPTS} ${RAM_OPTS} ${MAC_OPTS} ${MON_OPTS} ${SERIAL_OPTS} ${NET_OPTS} ${DISK_OPTS} ${EXTRA_OPTS} ${ARGUMENTS}"
|
||||||
ARGS=$(echo "$ARGS" | sed 's/\t/ /g' | tr -s ' ')
|
ARGS=$(echo "$ARGS" | sed 's/\t/ /g' | tr -s ' ')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user