From fc5f506df91519292bf17dabead19c8e64b29799 Mon Sep 17 00:00:00 2001 From: Roger Luethi Date: Tue, 26 Jul 2016 19:19:24 +0200 Subject: [PATCH] Make shutdown command work on Windows The recently introduced shutdown command did not make it into the Windows batch files when calling osbash.sh only with the "-w" option because in that case, vm_is_running would always return false. This patch drops that check in vm_acpi_shutdown entirely. It is redundant because every call to vm_acpi_shutdown is made from a location where the VM is known to run (of course the VM can be stopped in the meantime, but the removed check just made the window for that race somewhat smaller without actually eliminating it). Change-Id: Ia46705b2e9e78d9746a0c14685d724c53bfcdb47 --- labs/osbash/lib/osbash/virtualbox-functions.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/labs/osbash/lib/osbash/virtualbox-functions.sh b/labs/osbash/lib/osbash/virtualbox-functions.sh index 977397ac..3b74fcec 100644 --- a/labs/osbash/lib/osbash/virtualbox-functions.sh +++ b/labs/osbash/lib/osbash/virtualbox-functions.sh @@ -85,10 +85,9 @@ function vm_power_off { function vm_acpi_shutdown { local vm_name=$1 - if vm_is_running "$vm_name"; then - echo -e >&2 "${CStatus:-}ACPI shutdown for VM ${CData:-}\"$vm_name\"${CReset:-}" - $VBM controlvm "$vm_name" acpipowerbutton - fi + echo -e >&2 "${CStatus:-}ACPI shutdown for VM ${CData:-}\"$vm_name\"${CReset:-}" + $VBM controlvm "$vm_name" acpipowerbutton + # VirtualBox VM needs a break before taking new commands conditional_sleep 1 }