Recursive fai-class

Raphaël Pinson raphink at gmail.com
Fri Feb 15 10:01:52 CET 2008


Hello FAI devs,

As I was looking at the list of FAI classes and dependencies we use for our
production, I found that the system was a bit flat and that adding a
recursive class declaration would make it more powerful.

I'm attaching a patch to make fai-class work recursively (patch based on FAI
3.2.4).

This patch modifies the addclass() function to make it recursive, i.e.
whenever a new class is added, it checks for the presence of a
$classdir/$class file and includes the classes listed there, that way it is
done with $classdir/$HOSTNAME. Additionaly, a file named
/tmp/fai/parsed_classes is used to store the parsed files in order to
prevent loops.

Attached is a graphviz graph (test_class.png) showing the kind of
dependencies it allows

- the $classdir/10-base-classes script dynamiquely declares the DEBIAN_4
class. The $classdir/DEBIAN_4 file is found and contains GRUB, so the GRUB
class is defined ;
- "test" is $HOSTNAME given in the kernel arguments. The $classdir/test file
contains three classes: HEBEX, KERNEL and PART_CCISS_C0D0_defosof ;
- when the HEBEX class is added, a file $classdir/HEBEX is found and parsed,
declaring the 4 new classes: BOOT, MBR, NETWORK and CFD ;


Eventually, FAI_CLASS contains (# are added commentaries) :

----
# DEFAULT
DEFAULT
# Begin 10-base-classes
SOPHIA
LINUX
SOPHIA
AMD64
DEBIAN
DEBIAN_4
# File /var/lib/fai/config/class/DEBIAN_4 found
GRUB
# Back to 10-base-classes
DEBIAN_4_0
DEBIAN_AMD64
DEBIAN_4_AMD64
DEBIAN_4_0_AMD64
SOPHIA_AMD64
SOPHIA_DEBIAN
SOPHIA_DEBIAN_4
SOPHIA_DEBIAN_4_0
SOPHIA_DEBIAN_AMD64
SOPHIA_DEBIAN_4_AMD64
SOPHIA_DEBIAN_4_0_AMD64
SOPHIA_test
# Begin 25-disk-classes
PART_CCISS_C0D0_test
# Reading $classdir/test
HEBEX
# File /var/lib/fai/config/class/HEBEX found
BOOT
MBR
NETWORK
CFD
# Back to $classdir/test
KERNEL
PART_CCISS_C0D0_defosof
# $HOSTNAME
test
# LAST
LAST
----


I'd be happy if some of you can test the patch and give some feedback.


Cheers,


Raphaël
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.uni-koeln.de/pipermail/linux-fai-devel/attachments/20080215/2a01b86c/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fai-class_recursive.diff
Type: text/x-patch
Size: 1553 bytes
Desc: not available
Url : http://lists.uni-koeln.de/pipermail/linux-fai-devel/attachments/20080215/2a01b86c/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_class.png
Type: image/png
Size: 3563 bytes
Desc: not available
Url : http://lists.uni-koeln.de/pipermail/linux-fai-devel/attachments/20080215/2a01b86c/attachment.png 


More information about the linux-fai-devel mailing list