aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2016-12-28 11:48:19 -0200
committerSilvio Rhatto <rhatto@riseup.net>2016-12-28 11:48:19 -0200
commit9291fe73ccb0cfc002bf5efa338ff02df2706766 (patch)
treebafa591e4f5ddb26066ce52c860ed3c6f9f69401
parent77dc2e1d2e0ecc5c9f5cd1b91923a471d23533bc (diff)
downloadvbox-9291fe73ccb0cfc002bf5efa338ff02df2706766.tar.gz
vbox-9291fe73ccb0cfc002bf5efa338ff02df2706766.tar.bz2
Randomize SPICE port, allowing multiple running VMs on kvmx
-rwxr-xr-xkvmx5
1 files changed, 3 insertions, 2 deletions
diff --git a/kvmx b/kvmx
index 47f7907..432ae40 100755
--- a/kvmx
+++ b/kvmx
@@ -7,6 +7,7 @@
BASENAME="`basename $0`"
STORAGE="/var/cache/qemu"
SHARED="/var/data/load"
+PORT="$(($RANDOM + 1024))"
VM="$1"
# Check
@@ -20,7 +21,7 @@ fi
# Run virtual machine
kvm -m 2048 -name $VM -drive file=$STORAGE/$VM.img,if=virtio -vga qxl \
- -spice port=3001,addr=127.0.0.1,disable-ticketing,streaming-video=off,jpeg-wan-compression=never,playback-compression=off,zlib-glz-wan-compression=never,image-compression=off \
+ -spice port=$PORT,addr=127.0.0.1,disable-ticketing,streaming-video=off,jpeg-wan-compression=never,playback-compression=off,zlib-glz-wan-compression=never,image-compression=off \
-device virtio-serial-pci \
-device virtserialport,chardev=spicechannel0,name=com.redhat.spice.0 \
-chardev spicevmc,id=spicechannel0,name=vdagent \
@@ -28,4 +29,4 @@ kvm -m 2048 -name $VM -drive file=$STORAGE/$VM.img,if=virtio -vga qxl \
-fsdev local,id=$VM,path=$SHARED,security_model=none -device virtio-9p-pci,fsdev=$VM,mount_tag=$VM &
# Run spice client
-spicec --host localhost --port 3001
+spicec --host localhost --port $PORT