Various cleaning
This commit is contained in:
		| @ -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 | ||||
| } | ||||
|  | ||||
|  | ||||
| @ -66,5 +66,4 @@ get_hosts | ||||
| get_parts | ||||
| destroyvms | ||||
| run_qemu | ||||
| #clean | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user