aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-03-10 13:35:41 -0300
committerSilvio Rhatto <rhatto@riseup.net>2017-03-10 13:35:41 -0300
commit3c0410a7dc71f30cfc814459ba62297a259c180d (patch)
tree5238d357b9b02345777be772f7b37dc6e0933086
parent84af637b5cc0e67d58658469bcdfa42acd22c826 (diff)
downloadkvmx-3c0410a7dc71f30cfc814459ba62297a259c180d.tar.gz
kvmx-3c0410a7dc71f30cfc814459ba62297a259c180d.tar.bz2
Display spice log file; kvmx_spice: fixes PORT param and check if machine is running
-rwxr-xr-xkvmx31
1 files changed, 30 insertions, 1 deletions
diff --git a/kvmx b/kvmx
index 7efb47c..1605bd3 100755
--- a/kvmx
+++ b/kvmx
@@ -30,6 +30,20 @@ KVMX_BASE="$DIRNAME"
# Run spice client
function kvmx_spice {
+ if ! kvmx_running; then
+ echo "$BASENAME: guest $VM is not running"
+ exit 1
+ fi
+
+ # Ensure we have the right port configuration: we can also be
+ # running directly from command line.
+ PORT="`cat $PORTFILE`"
+
+ if [ -z "$PORT" ]; then
+ echo "$BASENAME: cannot get spice port for $VM."
+ exit 1
+ fi
+
# https://lists.freedesktop.org/archives/spice-devel/2013-September/014643.html
SPICE_NOGRAB=1 spicec --host localhost --port $PORT &> $SPICEFILE &
#spicy -h localhost -p $PORT
@@ -424,9 +438,24 @@ function kvmx_status {
# Print guest log
function kvmx_log {
- if [ -e "$LOGFILE" ]; then
+ local blank_line=""
+
+ if [ -s "$LOGFILE" ]; then
+ blank_line="1"
+ echo "In $LOGFILE:"
+ echo ""
cat $LOGFILE
fi
+
+ if [ -s "$SPICEFILE" ]; then
+ if [ ! -z "$blank_line" ]; then
+ echo ""
+ fi
+
+ echo "In $SPICEFILE:"
+ echo ""
+ cat $SPICEFILE
+ fi
}
# Dispatch