uncloud-mravi/uncloud/hack/hackcloud/vm.sh

30 lines
557 B
Bash
Raw Normal View History

2020-01-10 22:27:21 +00:00
#!/bin/sh
# if [ $# -ne 1 ]; then
# echo "$0: owner"
# exit 1
# fi
2020-01-10 22:27:21 +00:00
qemu=/usr/bin/qemu-system-x86_64
accel=kvm
2020-01-11 15:36:41 +00:00
#accel=tcg
2020-01-10 22:27:21 +00:00
memory=1024
cores=2
2020-01-12 13:43:06 +00:00
uuid=$(uuidgen)
mac=$(./mac-gen.py)
owner=nico
2020-01-10 22:27:21 +00:00
export bridge=br100
2020-01-12 13:44:53 +00:00
set -x
$qemu -name "uncloud-${uuid}" \
2020-01-10 22:27:21 +00:00
-machine pc,accel=${accel} \
-m ${memory} \
-smp ${cores} \
-uuid ${uuid} \
-drive file=alpine-virt-3.11.2-x86_64.iso,media=cdrom \
2020-01-12 13:43:06 +00:00
-netdev tap,id=netmain,script=./ifup.sh,downscript=./ifdown.sh \
-device virtio-net-pci,netdev=netmain,id=net0,mac=${mac}