diff options
-rwxr-xr-x | kvmx | 37 |
1 files changed, 36 insertions, 1 deletions
@@ -697,7 +697,28 @@ function kvmx_poweroff { fi kvmx_xephyr_stop - sleep 3 + + let poweroff_attempts="0" + echo -n "Waiting for machine to stop..." + while true; do + kvmx_running || break + + echo -n "." + let poweroff_attempts++ + + if [ "$poweroff_attempts" == "20" ]; then + echo "$BASENAME: guest $VM is still running" + echo "$BASENAME: please consider to stop it using \"kvmx $VM stop\"" + #kvmx_stop + exit 1 + fi + + sleep 3 + done + echo " done." + #sleep 3 + #echo "" + kvmx_status } @@ -1276,6 +1297,20 @@ function kvmx_run { kvmx_up $* } +# Restart machine +function kvmx_restart { + if ! kvmx_running; then + echo "Guest $VM was not running, so starting it anyway..." + kvmx_start + else + echo "Powering off guest $VM..." + kvmx_poweroff + + echo "Starting guest $VM again..." + kvmx_start + fi +} + # Connect to the guest using VNC function kvmx_vnc { if ! kvmx_running; then |