util: Add 'shutdown' argument option to vm_manager.sh

This allows for the VMs to be shutdown rather than destroyed. The can be
rebooted with `./vm_manager.sh` after shutdown.

Change-Id: I58329ec835af664bfb970b029e09ad16c5472015
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/71500
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Bobby R. Bruce
2023-06-12 12:19:25 -07:00
committed by Bobby Bruce
parent 1fd392e7bf
commit c391fdfbb4

View File

@@ -11,8 +11,8 @@ export VAGRANT_HOME=${SCRIPT_DIR}
param="up"
if [[ $# -ge 1 ]]; then
param=$1
if [[ "${param}" != "destroy" ]]; then
echo "Only valid parameter is 'destroy', to destroy all VMs"
if [[ "${param}" != "destroy" ]] && [[ "${param}" != "shutdown" ]]; then
echo "Only valid parameters are 'destroy' and 'shutdown' to destroy all VMs or shutdown all VMs"
exit 1
fi
fi
@@ -23,6 +23,8 @@ for (( i=1; i<=NUM_RUNNERS; i++ )); do
sed -i "s/ config.vm.hostname.*/ config.vm.hostname = \"${RUNNER_PREFIX}${i}\"/g" Vagrantfile-runner
if [[ "${param}" == "destroy" ]]; then
VAGRANT_VAGRANTFILE=Vagrantfile-runner vagrant destroy -f
elif [[ "${param}" == "shutdown" ]]; then
VAGRANT_VAGRANTFILE=Vagrantfile-runner vagrant halt -f
else
VAGRANT_VAGRANTFILE=Vagrantfile-runner vagrant up --provider=libvirt
fi
@@ -33,6 +35,8 @@ for (( i=1; i<=NUM_BUILDERS; i++ )); do
sed -i "s/ config.vm.hostname.*/ config.vm.hostname = \"${BUILDER_PREFIX}${i}\"/g" Vagrantfile-builder
if [[ "${param}" == "destroy" ]]; then
VAGRANT_VAGRANTFILE=Vagrantfile-builder vagrant destroy -f
elif [[ "${param}" == "shutdown" ]]; then
VAGRANT_VAGRANTFILE=Vagrantfile-builder vagrant halt -f
else
VAGRANT_VAGRANTFILE=Vagrantfile-builder vagrant up --provider=libvirt
fi