add ifdown support

This commit is contained in:
Nico Schottelius 2020-01-12 14:43:06 +01:00
parent 3188787c2a
commit 02526baaf9
2 changed files with 8 additions and 6 deletions

View file

@ -0,0 +1,3 @@
#!/bin/sh
echo $@!

View file

@ -1,7 +1,5 @@
#!/bin/sh #!/bin/sh
vmid=$1; shift
qemu=/usr/bin/qemu-system-x86_64 qemu=/usr/bin/qemu-system-x86_64
accel=kvm accel=kvm
@ -9,15 +7,16 @@ accel=kvm
memory=1024 memory=1024
cores=2 cores=2
uuid=732e08c7-84f8-4d43-9571-263db4f80080 uuid=$(uuidgen)
mac=$(./mac-gen.py)
export bridge=br100 export bridge=br100
$qemu -name uc${vmid} \ $qemu -name "uncloud-!${uuid}" \
-machine pc,accel=${accel} \ -machine pc,accel=${accel} \
-m ${memory} \ -m ${memory} \
-smp ${cores} \ -smp ${cores} \
-uuid ${uuid} \ -uuid ${uuid} \
-drive file=alpine-virt-3.11.2-x86_64.iso,media=cdrom \ -drive file=alpine-virt-3.11.2-x86_64.iso,media=cdrom \
-netdev tap,id=netmain,script=./ifup.sh \ -netdev tap,id=netmain,script=./ifup.sh,downscript=./ifdown.sh \
-device virtio-net-pci,netdev=netmain,id=net0,mac=02:00:f0:a9:c4:4e -device virtio-net-pci,netdev=netmain,id=net0,mac=${mac}