aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xkvmx22
1 files changed, 19 insertions, 3 deletions
diff --git a/kvmx b/kvmx
index 730e0df..c0895a7 100755
--- a/kvmx
+++ b/kvmx
@@ -511,12 +511,27 @@ function kvmx_up {
#usb_opts="$usb_opts -chardev spicevmc,name=usbredir,id=usbredirchardev3"
#usb_opts="$usb_opts -device usb-redir,chardev=usbredirchardev3,id=usbredirdev3"
+ # Check screen version
+ if screen --help | grep -q -- "-Logfile"; then
+ local screen_log="-L -Logfile $LOGFILE"
+ else
+ local screen_log="-L $LOGFILE"
+ fi
+
+ # Check kvm version
+ if kvm --help | grep -q -- "^-balloon"; then
+ local balloon="-balloon virtio"
+ else
+ local balloon="-device virtio-balloon"
+ fi
+
# Run virtual machine, nohup approach
# See https://en.wikipedia.org/wiki/Nohup#Overcoming_hanging
#nohup setsid kvm -m $memory -name $VM \
# -chardev "socket,id=monitor,path=$MONITORFILE,server,nowait" -mon chardev=monitor,mode=readline \
# -chardev "socket,id=serial0,path=$CONSOLEFILE,server,nowait" -device isa-serial,chardev=serial0 \
- # -smp $smp -cpu host -balloon virtio \
+ # -smp $smp -cpu host \
+ # $balloon \
# $graphics $shared \
# $image_opts \
# $spice_opts \
@@ -528,10 +543,11 @@ function kvmx_up {
# Run virtual machine, screen approach
# This is more immune to hangups
- screen -L $LOGFILE -S kvmx-qemu-$VM -d -m kvm -m $memory -name $VM \
+ screen $screen_log -S kvmx-qemu-$VM -d -m kvm -m $memory -name $VM \
-chardev "socket,id=monitor,path=$MONITORFILE,server,nowait" -mon chardev=monitor,mode=readline \
-chardev "socket,id=serial0,path=$CONSOLEFILE,server,nowait" -device isa-serial,chardev=serial0 \
- -smp $smp -cpu host -balloon virtio \
+ -smp $smp -cpu host \
+ $balloon \
$graphics $shared \
$image_opts \
$spice_opts \