NodesWithQemu


Howto start a OneLab node with qemu

1 Minimum requirement
If we declare the node Model in a particular way,
we can override the minimun requirement check at
the boot time of the node.
But this is not sufficient. We must use at least
256M of RAM memory and XG hard disk. (4G not sufficient)

2 Declare the node to OneLab and get the configuration file

2.1 Create the account
In order to declare a node and get the configuration file
you must create an account on the OneLab site:
http://<CSSITE>/db/accounts/register.php
Wait for the activation, then log in:
https://<CSSITE>/db/login/login.php
and declare your node here:
https://<CSSITE>/db/nodes/add.php

2.2 Declare the node
To declare a node you need some data,
at least the hostname and the ip address of the node.
ATTENTION:
hostname is hostname.domainname, according to me
this should be explicitly specified in the webpage
You can find the minimum hardware requirement here
http://<CSSITE>/doc/hardware.php
and the network requirement here
http://<CSSITE>/php/host/
Note: to bypass the minimal hardware requirements checking
you need to add /minhw string at the end of the node Model
(e.g. 'Custom/minhw').
#TODO Note: if you want to use a firewall you must allow
ssh, http, https in both directions and allow all kind of
connection used by the slices contained in the node.

2.3 Get the configuration file
After the node declaration you can get a file, planet.cfg
This file contains some information like IP addresses
and the authentication key, needed to authenticate the
node on the OneLab environment.

3 Install qemu

3.1 Follow this istruction according your operating system:
http://fabrice.bellard.free.fr/qemu/qemu-doc.html#SEC3

4 Preparing and start qemu with cdrom and floppy image

4.1 Download the image of the cdrom from OneLab site
http://<CSSITE>/download/OneLab%20Private-BootCD-3.3.iso

4.2 Prepare the disks
Create the first ide disk
# qcow2 is better
#qemu-img create disk.img 4G
qemu-img create -f qcow2 disk.img 4G
Create the floppy image and add the configuration file
qemu-img create floppy.img 1440k
Add the configuration file on Linux
mount -o loop floppy.img /mnt
cp planet.cfg /mnt
umount /mnt
Add the configuration file on FreeBSD (>4)
#TODO
qemu-img create floppy.img 1440k
mdconfig -a -t vnode -f floppy.img -u 0
mount /dev/md0c /mnt
cp planet.cfg /mnt
umount -d -u 0

4.3 start qemu as root (simple way)
#TODO network iface
Starting qemu as root is the fast way to get the thing working.
We avoid to do this in the next section.

qemu -m 256 -hda disk.img -fda floppy.img \
-cdrom OneLab\ Private-BootCD-3.3.iso -boot d \
-net nic,macaddr=00:05:1A:00:00:01 -net tap,script=node_ifup

-m 256 is required because the node image require it

the file node_ifup must be an executable script used to
configure the network interface. Can be empty because
the network interface is correctly configured by the node.

for the other details: man qemu

5 qemu accelerator, qemu as user on FreeBSD (>6)

# TODO the user must be added to wheel group
5.1 qemu accelerator
#TODO /usr/ports/emulators/kqemu-kmod/

5.2 load modules
load the following modules with kldload
kqemu, linux, aio, bridge, if_tap

or put in /boot/loader.conf the following lines
kqemu_load="YES" # Set this to YES to load the QEMU acceleration layer
linux_load="YES" # Linux emulation
aio_load="YES" # asynchronous I/O
bridge_load="YES" # bridging support
if_tap_load="YES" # Ethernet tunnel software network interface
kern.maxdsiz=1000000000 # set max data size, userd for qemu with 256M (or more) of RAM, for 1024 increase this value

5.3 configure sudo
this is not required to start a OneLab node.

5.4 configure bridging and allow users to use tap devices
edit /etc/sysctl.conf and add the following lines:
# Used to start network interface on qemu
net.link.ether.bridge_cfg=em0,tap0,tap1,tap2,tap3,tap6,tap7
net.link.ether.bridge.enable=1
net.link.tap.user_open=1

5.6 set the permission on tap devices
edit /etc/devfs.conf and add the following lines:
# Used by qemu to configure the network interface
# using the wildcard _does't work_
# to do this in the right way
# you have to use devfs.rules (5)
perm tap1 0666
perm tap2 0666
perm tap3 0666
perm tap4 0666
perm tap5 0666
perm tap6 0666
perm tap7 0666
perm tap8 0666
perm tap9 0666

# The follow line will not work, because the wildcard
# will not allow the creation of the devices
perm tap* 0666

5. Reboot a node
First of all you should use the right procedure
to shut down a node, that is notify the users,
log in as site_admin, and do:
sudo /sbin/shutdown -h 5 "Scheduled maintenance, please save your work and logout"
If this is not possible (you can't log in) then reboot
the node sending ctr-alt-canc from vncviewer as example.
From vncviewer press F8 and then "send crl-alt-canc".

#TODO: sending a POD from the OneLab site. (I never used this)

6 Version used
qemu-0.8.0-3.fc4 on linux, fedora core 4
(the network and permission settings previously
described are related to FreeBSD)
qemu version 0.8.2, FreeBSD 6.2-PRERELEASE
qemu version qemu-0.9.0_3, FreeBSD 6.2-STABLE

7 Troubleshooting
TODO: se il nodo dopo pl_boot dice che ha ricevuto un comando di
interrompere il boot,o a dire [n] quando chiede se andare in breackpoint mode
8 Script
TODO