aboutsummaryrefslogtreecommitdiff
path: root/kvmx
blob: 47f79071f6646d9968253bb980fcc6ca1358929a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
#
# KVM and SPICE client wrapper
#

# Parameters
BASENAME="`basename $0`"
STORAGE="/var/cache/qemu"
SHARED="/var/data/load"
VM="$1"

# Check
if [ -z "$VM" ]; then
  echo "usage: $BASENAME <vm>"
  exit 1
elif [ ! -e "$STORAGE/$VM.img" ]; then
  echo "file not found: $STORAGE/$VM.img"
  exit 1
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 \
    -device virtio-serial-pci \
    -device virtserialport,chardev=spicechannel0,name=com.redhat.spice.0 \
    -chardev spicevmc,id=spicechannel0,name=vdagent \
    -smp 2 -soundhw ac97 -cpu host -balloon virtio \
    -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