spice port selected from range so more than one vm can be run

This commit is contained in:
evereux 2020-04-18 15:21:05 +01:00
parent 21431084a7
commit c63a17e93e

View File

@ -104,6 +104,19 @@ function get_port() {
done
}
function get_spice_port() {
local PORT_START=5930
local PORT_RANGE=9
while true; do
local CANDIDATE=$[${PORT_START} + (${RANDOM} % ${PORT_RANGE})]
(echo "" >/dev/tcp/127.0.0.1/${CANDIDATE}) >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "${CANDIDATE}"
break
fi
done
}
enable_usb_passthrough() {
local DEVICE=""
local USB_BUS=""