Commit 1c78e3c8 authored by Kroese's avatar Kroese Committed by GitHub
Browse files

feat: Passthrough multiple devices

parent 9f17dfa9
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -178,6 +178,8 @@ else
fi

: ${DEVICE:=''}        # Docker variable to passthrough a block device, like /dev/vdc1.
: ${DEVICE2:=''}
: ${DEVICE3:=''}

if [ -n "${DEVICE}" ]; then

@@ -189,3 +191,25 @@ if [ -n "${DEVICE}" ]; then
    -device scsi-hd,bus=hw-userdata4.0,channel=0,scsi-id=0,lun=0,drive=drive-userdata4,id=userdata4,rotation_rate=${DISK_ROTATION},bootindex=6"

fi

if [ -n "${DEVICE2}" ]; then

  [ ! -b "${DEVICE2}" ] && error "Device ${DEVICE2} cannot be found! Please add it to the 'devices' section of your compose file." && exit 56

  DISK_OPTS="${DISK_OPTS} \
    -device virtio-scsi-pci,id=hw-userdata5,bus=pcie.0,addr=0x5 \
    -drive file=${DEVICE2},if=none,id=drive-userdata5,format=raw,cache=${DISK_CACHE},aio=${DISK_IO},discard=${DISK_DISCARD},detect-zeroes=on \
    -device scsi-hd,bus=hw-userdata5.0,channel=0,scsi-id=0,lun=0,drive=drive-userdata5,id=userdata5,rotation_rate=${DISK_ROTATION},bootindex=7"

fi

if [ -n "${DEVICE3}" ]; then

  [ ! -b "${DEVICE3}" ] && error "Device ${DEVICE3} cannot be found! Please add it to the 'devices' section of your compose file." && exit 57

  DISK_OPTS="${DISK_OPTS} \
    -device virtio-scsi-pci,id=hw-userdata6,bus=pcie.0,addr=0x6 \
    -drive file=${DEVICE3},if=none,id=drive-userdata6,format=raw,cache=${DISK_CACHE},aio=${DISK_IO},discard=${DISK_DISCARD},detect-zeroes=on \
    -device scsi-hd,bus=hw-userdata6.0,channel=0,scsi-id=0,lun=0,drive=drive-userdata6,id=userdata6,rotation_rate=${DISK_ROTATION},bootindex=8"

fi