Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
5 changes: 5 additions & 0 deletions base/scripts/dnsmasq.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,9 @@ iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i br0 -o eth0 -j ACCEPT

# Tell the first node that it can start provisioning
if [ -n "${NEXT_HOST}" ]; then
touch /shared/${NEXT_HOST}.start
fi

exec dnsmasq -d ${DHCP_HOSTS} --dhcp-range=192.168.66.10,192.168.66.200,infinite
38 changes: 38 additions & 0 deletions base/scripts/vm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,46 @@ if [ ! -e /dev/kvm ]; then
mknod /dev/kvm c 10 $(grep '\<kvm\>' /proc/misc | cut -f 1 -d' ')
fi

# Provisioning happens from outside, just start qemu and wait until the vmi shuts down from inside
if [ "${HOSTNAME}" == "provision" ] ; then
exec qemu-system-x86_64 -enable-kvm -drive format=qcow2,file=${next},if=virtio,cache=unsafe \
-device virtio-net-pci,netdev=network0,mac=52:55:00:d1:55:${n} \
-netdev tap,id=network0,ifname=tap${n},script=no,downscript=no \
-device virtio-rng-pci \
-vnc :${n} -cpu host -m ${MEMORY} -smp ${CPU} ${QEMU_ARGS}
fi

function finish {
kill -9 $(jobs -p)
}

trap finish EXIT

qemu-system-x86_64 -enable-kvm -drive format=qcow2,file=${next},if=virtio,cache=unsafe \
-device virtio-net-pci,netdev=network0,mac=52:55:00:d1:55:${n} \
-netdev tap,id=network0,ifname=tap${n},script=no,downscript=no \
-device virtio-rng-pci \
-vnc :${n} -cpu host -m ${MEMORY} -smp ${CPU} ${QEMU_ARGS} &

# wait until it is our turn if we are not the first node
if [ "${FIRST_NODE}" != "true" ]; then
while [ ! -f /shared/${HOSTNAME}.start ] ; do
echo "Waiting for previous container to be done."
sleep 1;
done
fi

if [ -e /scripts/${HOSTNAME}.sh ]; then
ssh.sh sudo /bin/bash < /scripts/${HOSTNAME}.sh
else
ssh.sh sudo /bin/bash < /scripts/nodes.sh
fi

# node is ready
touch /shared/${HOSTNAME}.ready

# Tell the next node that it can provision
if [ -n "${NEXT_HOST}" ]; then
touch /shared/${NEXT_HOST}.start
fi
wait
121 changes: 0 additions & 121 deletions gocli/Gopkg.lock

This file was deleted.

30 changes: 0 additions & 30 deletions gocli/Gopkg.toml

This file was deleted.

2 changes: 1 addition & 1 deletion gocli/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ push: fmt
bazel run //:push-all

generate:
dep ensure
glide install --strip-vendor
bazel run //:gazelle
1 change: 1 addition & 0 deletions gocli/cmd/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = [
"deploy.go",
"ports.go",
"provision.go",
"rm.go",
Expand Down
Loading