Various cleaning

This commit is contained in:
Guillaume 2023-06-14 23:38:35 +02:00
parent ba59df1892
commit b5734a4b0f
2 changed files with 2 additions and 19 deletions

View File

@ -93,20 +93,10 @@ get_parts() {
for part in kernel initrd-v2 for part in kernel initrd-v2
do do
partfile=$ctxdir/data/$host/$part 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 done
diskfile=$ctxdir/data/$host/disk diskfile=$ctxdir/data/$host/disk
test -f $diskfile || truncate -s ${QEMU_DISK_SIZE:-30G} $diskfile test -f $diskfile || { pinfo "Creating disk $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
done done
} }
@ -128,10 +118,4 @@ create_kubeconfig() {
chmod 444 $ctxdir/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
}

View File

@ -66,5 +66,4 @@ get_hosts
get_parts get_parts
destroyvms destroyvms
run_qemu run_qemu
#clean