From 1a6e0fbacae260fe702ae9b7ea098985ffb3e0cf Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sun, 31 Dec 2017 00:32:39 -0200 Subject: Use qemu monitor at kvmx_poweroff when ssh_support is off --- kvmx | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'kvmx') diff --git a/kvmx b/kvmx index 5da8fca..979620e 100755 --- a/kvmx +++ b/kvmx @@ -621,6 +621,9 @@ function kvmx_suspend { PID="`cat $PIDFILE`" kill -STOP $PID + # Alternative + #kvmx_monitor stop + SPICEPID="`cat $SPICEFILE`" if ps $SPICEPID &> /dev/null; then @@ -671,6 +674,9 @@ function kvmx_resume { PID="`cat $PIDFILE`" kill -CONT $PID + + # Alternative + #kvmx_monitor system_wakeup } # Poweroff the guest @@ -684,7 +690,12 @@ function kvmx_poweroff { $DIRNAME/$BASENAME xpra $VM stop fi - echo /usr/bin/sudo poweroff | kvmx_ssh &> /dev/null + if [ "$ssh_support" == "y" ]; then + echo /usr/bin/sudo poweroff | kvmx_ssh &> /dev/null + else + kvmx_monitor system_powerdown + fi + kvmx_xephyr_stop sleep 3 kvmx_status @@ -707,6 +718,11 @@ function kvmx_hibernate { exit 1 fi + if [ "$ssh_support" != "y" ]; then + echo "$BASENAME: ssh_support is disabled for guest $VM" + exit 1 + fi + if ! kvmx_ssh test -s /swapfile; then echo "Seems like /swapfile is absent in the guest, aborting" exit 1 @@ -1466,7 +1482,13 @@ function kvmx_monitor { exit 1 fi - socat $MONITORFILE STDIO + if [ -z "$1" ]; then + socat $MONITORFILE STDIO + else + socat STDIO $MONITORFILE <