Devserver
From Olpcaustria
Contents |
how to connect to our dev server
Our development server runs some VNC instances on olpcaustria.org:0 ... olpcaustria.org:99 . Please check out which instances are running by directing your VNC client to one of these addresses.
Running your own VNC qemu instance
(also see http://wiki.laptop.org/go/Remote_Display )
Remotely displaying a qemu session:
First start the qemu session on the host:
qemu -kernel-kqemu -vnc 0 -k en-us olpc-redhat-stream-development-devel_ext3.img
The flag -vnc 0 tells qemu to direct the VGA output to the VNC session 0.
Next connect with a proper VNC viewer on your laptop/PC which has the VGA output . On Mac OS X Chicken of the VNC can not properly handle the VGA output of the qemu emulation. So, instead use VNCviewer Direct VNCViewer to your host running the qemu instance and set it to fullscreen. Voila! You should have a much faster remote access possibility than with X11 forwarding. Given a proper network (LAN) and a fast qemu server your presentation will now be faster than the original B2 machines.
Next step: cross connect many qemu instances with VDE to create a virtual mesh network. This way we will be able to experimentally try out mesh/networked apps
how to start many networked qemu instances with VDE
The idea
For many developers it can be quite practical to test networked applications (aeh,... "activities"). But without many XOs this can be quite hard. So the goal of this small hack is to connect many qemu virtual instances of the developer image to each other with a virtual network. For this purpose I used VDE (Virtual Distributed Ethernet).
Included is also a small script which you can use to assign unique IP addresses to each qemu image. The VDE FAQ is the best starting point for detailed questions. This short howto is an extract of this document.
The host side
On the host:
- install VDE and Qemu
- make sure that you have vdeq installed
- # vde_switch -tap tap0 -daemon
- # ifconfig tap0 <IP>
- # chmod 755 /tmp/vde.ctl
- # ifconfig tap0 10.0.0.1
- # echo "1" > /proc/sys/net/ipv4/ip_forward
- # iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
starting the qemu image
Now you are ready to connect the qemu images to the world and to each other via the VDE switch Be sure to connect it to the vlan=0 switch
- # sudo vdeqemu -kernel-kqemu -vnc $i -net nic,vlan=0,macaddr=52:54:00:12:34:$i -net vde,vlan=0 -k en-us olpc-redhat-stream-development-devel_ext3.img &
replace $i with the VNC screen number (01...99)
Now the final step ist to set the IP adress in the qemu instance to 10.0.1.$i and the default route accordingly
# ifconfig eth0 inet 10.0.1.$i # route add default gw 10.0.0.1
Another way to do this automatically from within the qemu image is to use this script in /etc/rc5.d/qemuVDE (create this script):
#!/bin/sh
# check if we are running from within qemu
# if not, then don't run this script since it sets the IP adr
if [ "$(grep -i geode /proc/cpuinfo | wc -l)" != "0" ] ; then
echo "qemuVDE: running on a real XO. NOP"
exit 0
fi
i=$( ifconfig eth0 | grep HWaddr | awk '// { print $5; }' | cut -d : -f 6 )
#echo "i=$i"
ifconfig eth0 inet 10.0.1.$i
route add default gw 10.0.0.1
echo "qemu VDE network set up, well done!"
This script reads the $i variable from the MAC address and will set the IP adress accordingly.
You should be able to ping hosts on the internet and all the other qemu instances
NOTE: each instance must be a copy of the development image! Running multiple instances with the same .img file is asking for file system corruption problems in the images. NOTE2: when connecting to the VNC instance from a mac. Chicken of the VNC did not work for me. VNCViewer did, but it was a bit buggy.
have fun! Please report any bugs/ suggestions to: mailto:aaron@lo-res.org
starting many instances automatically
If you want to start many instances from a script then a few things need to be done first:
- each instance should have it's own distinct sugar user
- each instance needs to operate on it's own image file (or use COW (copy on write))
So this is my script for starting N instances:
#!/bin/sh
if [ $# -lt 1 ]; then
echo "must specify number of instances as parameter"
exit 1
fi
for i in $( seq -w $1 ) ; do
# qemu-img create -b base_image -f qcow image_$i.qcow 1G # this would be the COW approach
cp base_image image_$i.img
mount -o loop,offset=31744 image_$i.img /mnt/
sed -i "s/nickname =.*\$/nickname = virtual_$i/" /mnt/home/olpc/.sugar/default/config
umount /mnt
sudo vdeqemu -kernel-kqemu -vnc $i \
-net nic,vlan=0,macaddr=52:54:00:12:34:$i -net vde,vlan=0 \
-k en-us \
-hda image_$i.img &
sleep 10
done
--AaronK 02:35, 28 June 2007 (CEST)

