FAI Djangofied

Stephan Hermann sh at sourcecode.de
Thu Jul 30 19:29:42 CEST 2009

Hi Henning, Moins List,

On Thu, 30 Jul 2009 14:00:51 +0200
Henning Sprang <henning at sprang.de> wrote:

> Stephan Hermann wrote:
> > Dear FAI Fanatics,
> > 
> > I actually found the time to release my latest project:
> > 
> > FAI-Django ;)
> Sounds interesting - finally somebody really doing it :)

Hehe :) 

> Did you have a look at the things we wrote up (years ago -
> http://faiwiki.debian.net/index.php/GUIConcept ) about the
> requirements and software design for a FAI GUI or did you start from
> scratch?

Actually I started from scratch because I was in need of something for
our new FAI setup.

But as I'm working in my sparetime as well on those things, I started
to write this app.

I never read the wikipage (/me is ashamed) but to be honest let me
summarize what is already working and right now in production:


* automatically_recognizing_new_hosts_in_the_network
  - This is working already. What I did was to replace task_sysinfo and
    call inside this script a python tool.
    This python tool uses as well the django ORM backend models I
    designed. It uses furthermore python-dmidecode...
    + It determines server UUID, serial number, manufacturer, product
      name (e.g. hp bl465c etc. tested also with Fujitsu Siemens)
    + It grabs all known NICs a la:

		for i in ipconfig.stdout:
	            if found is not None:
	and pushing them into a table, which has a relation to the
    + It also creates some more table entries in different tables,
      which have a one to one relation to the server
    (ADDHERE: I make a difference between the hardware (e.g. Server)
    and the logical entity (OS+Software+OS Depended Network Interfaces)
    + after that it reboots and set the status to localboot
    Some additions to it:
	Your list on the wiki:
		+ the FAI Gui creates a DHCP entry for the host and
		reboots the dhcp server 

        This was the first problem I erased completly.
	Hardwired DHCP Entries (wired on MACs) are for pimps, what real
	admins want is a TFTPD which does the work ;)
	I tweaked tftpy, a tftp(d) suite written in python.
	I tweaked it to use as well djagno ORM models. It catches the
	01-<MAC ADDR + s/\:/\-/> file and converts it into a real mac
	It looks up the mac addr from the database, and depending on
	the installation status is writes an pxelinux file for booting
	a kernel with install action, or writes an pxelinux file for
	If the mac is not found, the server never existed in our
	database and it starts a sysinfo task automatically, after this
	task the server is known to the database.
	Depending on your wishes you can deal with more boot states.
	Your imagination is not limited here :)

	Why? Because normally you deploy your network with a full port
	access mode or native vlan configuration on your switches...so
	depending on your hw server, it decides which NIC it uses for
	PXE..so as we know all macs in our database...you get the
	point :)

	Your point on the wiki:
		+ optionally(this is not needed for hosts that need not
		  to be accesed by dns name), the admin can also chose
		  a hostname for the host, and the fai-gui adds this
		  name to the bind config 

	This is not done here on the HW Server side..this is a logical
	entity and will be done when you configure your HOST on the

	Your point on the wiki: 
		+ when logging into the fai gui, the admin is
		  üpresented with a list(or one) of mac addresses of
		  new hosts. 

	This is WoP, means Web UI stuff, which will be implemented.
	Easy task.

Big point on wiki:
	+ editing class definitions for a host in the GUI 
		+ this is done on host level (UI side)
		+ Classes will be defined before hand
		+ Depending on the user/group permissions inside Django
		  UI, the admin can only add default classes (in order)
		+ WoP: Add standard classes depending on the HW of the
		  server (e.g. diff. partitions etc.)
		+ 50-host-classes looks like this:
#! /bin/bash

. ../lib/nv_funcs.sh

host_id=`get_host_id ${server_id}`
DJANGO_SETTINGS_MODULE=settings $FAI/lib/django_funcs.py
update_install_status ${server_id} 2
MY_CLASSES=`get_classes_by_hostid ${host_id}`
my_hostname=`get_hostname_by_hostid ${host_id}`
/bin/hostname ${my_hostname}
echo "${MY_CLASSES}" 

exit 0

This is suboptimal, because it's because of the transition of standard
shell stuff to python django scripts.
Will be replaced with real code :) but to get the point, this is all
you need.

Big point on Wiki:
	+ change a class'es properties 

		+ Well, this is not trivial,
		+ I thought about putting shell scripts into the
		  database and let a task pulling them and
		  executing them depending on the class. This sounds a
		  bit weired, but gives you still the power of FAI,
		  freedom of choice :)

	+ Package configuration per class will be implemented.

Right now, I have also a VLan Management, IP Management and a
debian canonical /etc/network/interface generator included. This needs
to be improved to work as well with other distros which can be deployed
via FAI.

> I hope I'll come to look at the code and test it in more dtails these
> days - is https://code.launchpad.net/~shermann/+junk/django-faimgr the
> right place to find the newest stuff? (the "+junk" is a bit
> irritating :) )

The +junk is the namespace for personal bzr branches...I'll create a
project for that, no worries...

To be honest, I'm using right now this tool as simple asset management
and documentation. Everything I need during my deployment phase will be
implemented directly or a couple of hours later...or in between other
tasks ;) 

It's not as easy as it sounds...but the beginning is made...

Hope that mail wasn't too boring ;)



| Stephan '\sh' Hermann    | OSS Dev / SysAdmin         |
| JID: sh at linux-server.org | http://www.sourcecode.de/  | 
| GPG ID: 0xC098EFA8	   | http://leonov.tv/          |
| FP: 3D8B 5138 0852 DA7A B83F DCCB C189 E733 C098 EFA8 |

More information about the linux-fai mailing list