diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2020-05-11 18:42:13 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2020-05-11 18:42:13 -0300 |
commit | 3571ea4a5f71afbcdcd915f2a84a6622e3cb56be (patch) | |
tree | f84eae2ef4b638dcd15208bfd0ca354f54c89e52 | |
parent | 521838ecfee5095770214a2246c0c95307215bd1 (diff) | |
download | kvmx-3571ea4a5f71afbcdcd915f2a84a6622e3cb56be.tar.gz kvmx-3571ea4a5f71afbcdcd915f2a84a6622e3cb56be.tar.bz2 |
Fix: support for newer kvm and screen such as those from debian buster
-rwxr-xr-x | kvmx | 22 |
1 files changed, 19 insertions, 3 deletions
@@ -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 \ |