aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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