]> gitweb.fluxo.info Git - kvmx.git/commitdiff
Adds monitor action
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 30 Dec 2017 17:11:30 +0000 (15:11 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 30 Dec 2017 17:11:30 +0000 (15:11 -0200)
README.md
kvmx

index 7d4158da54e86dc08308323f4e6cad24a5e20a0c..6d0eb5442fa679da735fc2e65a03598099501d9d 100644 (file)
--- a/README.md
+++ b/README.md
@@ -17,7 +17,7 @@ sources, you'll feel welcome here :)
 
 KVMX currently needs a Debian-based system and the following dependencies:
 
-    sudo apt install git qemu qemu-kvm virt-viewer spice-client spice-client-gtk
+    sudo apt install git qemu qemu-kvm virt-viewer spice-client spice-client-gtk socat
 
 If you plan to create guest images, you may also want the following packages:
 
diff --git a/kvmx b/kvmx
index ee32862be2c1e32f3994d289f68d2a26b2594e04..f896815acf01a57e5a96af925e32200c50565d5e 100755 (executable)
--- a/kvmx
+++ b/kvmx
@@ -166,6 +166,7 @@ function __kvmx_initialize {
     SPICELOG="$LOG_DIR/spice"
     XPRALOG="$LOG_DIR/xpra"
     XDMCPLOG="$LOG_DIR/xdmcp"
+    MONITORFILE="$STATE_DIR/monitor"
 
     if [ -e "$STORAGE/ssh/$VM.key" ]; then
       mkdir -p "$STORAGE/ssh"
@@ -376,6 +377,7 @@ function kvmx_up {
       -device virtio-serial-pci \
       -device virtserialport,chardev=spicechannel0,name=com.redhat.spice.0 \
       -chardev spicevmc,id=spicechannel0,name=vdagent \
+      -chardev "socket,id=monitor,path=$MONITORFILE,server,nowait" -mon chardev=monitor,mode=readline \
       -smp $smp -soundhw ac97 -cpu host -balloon virtio \
       -net nic,model=$nic_model \
       -net user,hostfwd=tcp:127.0.0.1:$SSH-:22,hostfwd=udp:127.0.0.1:$XDMCP_PORT-:177$hostfwd $qemu_opts &> $LOGFILE < /dev/null &
@@ -1370,6 +1372,21 @@ function kvmx_mv {
   kvmx_rename $*
 }
 
+# Interface to QEMU monitor
+function kvmx_monitor {
+  if ! kvmx_running; then
+    echo "$BASENAME: guest $VM is not running"
+    exit 1
+  fi
+
+  if ! which socat &> /dev/null; then
+    echo "$BASENAME: please install socat"
+    exit 1
+  fi
+
+  socat $MONITORFILE STDIO
+}
+
 # Install system
 function kvmx_install {
   if kvmx_running; then