From 9291fe73ccb0cfc002bf5efa338ff02df2706766 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Wed, 28 Dec 2016 11:48:19 -0200 Subject: Randomize SPICE port, allowing multiple running VMs on kvmx --- kvmx | 5 +++-- 1 file 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 -- cgit v1.2.3