From b5734a4b0f785dbdeebeb081e91c713a2088490f Mon Sep 17 00:00:00 2001 From: Guillaume Date: Wed, 14 Jun 2023 23:38:35 +0200 Subject: [PATCH] Various cleaning --- scripts/.common | 20 ++------------------ scripts/1.qemu.sh | 1 - 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/scripts/.common b/scripts/.common index 98ed440..c37f039 100644 --- a/scripts/.common +++ b/scripts/.common @@ -93,20 +93,10 @@ get_parts() { for part in kernel initrd-v2 do partfile=$ctxdir/data/$host/$part - test -f $partfile || dls /hosts/$host/$part -o $partfile + test -f $partfile || { pinfo "Downloading $part for host $host" && dls /hosts/$host/$part -o $partfile; } done diskfile=$ctxdir/data/$host/disk - test -f $diskfile || truncate -s ${QEMU_DISK_SIZE:-30G} $diskfile - done -} - -destroyvms() { - for host in ${!hosts[*]}; do - host=$1 - if test -f $ctxdir/data/$host/pid ; then - pinfo "Detected a pid file, killing process in case VM was already started" - kill $(cat $ctxdir/data/$host/pid) && sleep 1 - fi + test -f $diskfile || { pinfo "Creating disk $diskfile" && truncate -s ${QEMU_DISK_SIZE:-30G} $diskfile; } done } @@ -128,10 +118,4 @@ create_kubeconfig() { chmod 444 $ctxdir/kubeconfig } -clean() { - set +e - sudo iptables -t nat -D POSTROUTING -j MASQUERADE -s $QEMU_BR_IP \! -o $QEMU_BR_NAME &>/dev/null - sudo iptables -D FORWARD -o $QEMU_BR_NAME -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT &>/dev/null - sudo iptables -D FORWARD -j ACCEPT -i $QEMU_BR_NAME &>/dev/null -} diff --git a/scripts/1.qemu.sh b/scripts/1.qemu.sh index b76b30a..7999921 100755 --- a/scripts/1.qemu.sh +++ b/scripts/1.qemu.sh @@ -66,5 +66,4 @@ get_hosts get_parts destroyvms run_qemu -#clean