virshall can start, shutdown or destroy all VMs on a hypervisor LAB so I can remove 'start' from create and pristine; sometimes it is useful to only create (but not start) the LABs. Similarly, sometimes bringing the LAB into pristine state, but without restarting the VMs, is useful.
24 lines
608 B
Bash
Executable File
24 lines
608 B
Bash
Executable File
#!/bin/sh
|
|
BUILD=${BUILD:=default}
|
|
LAB=${LAB:=0}
|
|
|
|
## Do not touch below this line
|
|
LABDIR=/var/lab
|
|
STAGING=$LABDIR/staging
|
|
HVN="hvn${LAB}.lab.ipng.ch"
|
|
CMD=$1
|
|
|
|
[ "$CMD" != "start" -a "$CMD" != "shutdown" -a "$CMD" != "destroy" ] && {
|
|
echo "Usage: LAB=0 ./virshall start|shutdown|destroy"
|
|
exit
|
|
}
|
|
|
|
echo "* Executing $CMD against all VMs on lab $LAB"
|
|
ssh root@$HVN "set -x; for node in 0 1 2 3; do VM=vpp${LAB}-\${node}; virsh $CMD \$VM; done"
|
|
|
|
[ "$CMD" = "start" ] && {
|
|
echo "* Committing OVS config"
|
|
scp overlays/$BUILD/ovs-config.sh root@$HVN:$LABDIR
|
|
ssh root@$HVN "set -x; $LABDIR/ovs-config.sh"
|
|
}
|