]> gitweb.fluxo.info Git - kvmx.git/commitdiff
Use qemu monitor at kvmx_poweroff when ssh_support is off
authorSilvio Rhatto <rhatto@riseup.net>
Sun, 31 Dec 2017 02:32:39 +0000 (00:32 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Sun, 31 Dec 2017 02:32:39 +0000 (00:32 -0200)
kvmx

diff --git a/kvmx b/kvmx
index 5da8fcab4d76d7ffdf75a894784c379b9a85f47d..979620e27280a6792814ef72c3780abd357c51ca 100755 (executable)
--- 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 <<EOF
+$1
+EOF
+  fi
 }
 
 # Install system