diff --git a/scripts/.cleanup.sh b/scripts/.cleanup.sh index 018787a..4ac671a 100755 --- a/scripts/.cleanup.sh +++ b/scripts/.cleanup.sh @@ -7,16 +7,6 @@ stopdls() { fi } -destroyvms() { - for host in ${!hosts[*]}; do - if test -f $ctxdir/data/$host/pid ; then - pid=$(cat $ctxdir/data/$host/pid) - pinfo "Cleaning VM $host with PID $pid..." - kill $pid && sleep 1 - fi - done -} - cleanuppaths() { PATHS="data secrets kubeconfig cache dist" cd $ctxdir @@ -29,6 +19,7 @@ cleanuppaths() { } cleanupssh() { + set -x for host in ${!hosts[*]}; do ssh-keygen -R ${hosts[$host]} &>/dev/null done @@ -55,6 +46,6 @@ stopdls declare -A hosts get_hosts destroyvms -cleanuppaths +#cleanuppaths cleanupssh -cleanupnetwork +#cleanupnetwork diff --git a/scripts/.common b/scripts/.common index c37f039..50ee599 100644 --- a/scripts/.common +++ b/scripts/.common @@ -119,3 +119,17 @@ create_kubeconfig() { } +destroyvms() { + for host in ${!hosts[*]}; do + if test -f $ctxdir/data/$host/pid ; then + pid=$(cat $ctxdir/data/$host/pid) + if ! test -d /proc/$pid ; then + pinfo "VM $host seems not running" + else + pinfo "Cleaning VM $host with PID $pid..." + kill $pid && sleep 1 + fi + fi + done +} + diff --git a/scripts/1.qemu.sh b/scripts/1.qemu.sh index 7999921..a15dc44 100755 --- a/scripts/1.qemu.sh +++ b/scripts/1.qemu.sh @@ -37,6 +37,7 @@ setup_network_qemu() { echo "allow $QEMU_BR_NAME" >> /etc/qemu/bridge.conf fi } + run_qemu() { id=1 for host in ${!hosts[*]}; do @@ -54,6 +55,8 @@ run_qemu() { } # # # # # # # # + + source $(dirname $0)/.common check_root prereqs