Make virtualbox cleanup less repetitive and log statements

pull/5584/head
tstromberg 2019-10-09 14:15:33 -07:00
parent fac45f54a4
commit c389944391
1 changed files with 5 additions and 8 deletions

View File

@ -134,14 +134,11 @@ if type -P virsh; then
fi
if type -P vboxmanage; then
vboxmanage list vms \
| egrep -o '{.*?}' \
| xargs -I{} vboxmanage startvm {} --type emergencystop || true
vboxmanage list vms \
| egrep -o '{.*?}' \
| xargs -I{} vboxmanage unregistervm {} || true
for guid in $(vboxmanage list vms | egrep -Eo '\{[-a-Z0-9]+\}'); do
echo "- Removing stale VirtualBox VM: $guid"
vboxmanage startvm $guid --type emergencystop || true
vboxmanage unregistervm $guid || true
done
echo ">> VirtualBox VM list after clean up (should be empty):"
vboxmanage list vms || true
fi