Another attempt at setup-storage

Thomas Neumann blacky+fai at fluffbunny.de
Fri May 30 16:07:14 CEST 2014


Hello

I have forked the github repo for fai (https://github.com/faiproject/fai) and 
removed everything that is not related to setup-storage. (Since setup-storage 
is packaged as a standalone 'fai-setup-storage' package anyway.) I'm currently 
in the process of cleaning up the existing code. At the moment it's really 
just cleanup, there's no new functionality.

The roadmap is something like this:

- remove hardcoded paths (complete)
- remove external helper scripts (in progress)
- convert global variables into actual function parameters (in progress)
- provide unit tests for the components
- ....
- add new features


There's nothing special in fai-vol_id and fai-disk-info, which requires them 
to be shell scripts. It just complicates things.

The biggest problem in the existing setup-storage is the extensive usage of 
global variables. You don't really know what input is required by a function 
and where it performs its changes. This makes it extremely hard to understand 
what is actually going on.

But I think I have found a nice temporary solution until proper unit tests are 
available. I don't change the original code, but instead copy it into a 
separate module and perform my changes there. Before the relevant code is 
called I duplicate all required variables, execute _both_ functions (old and 
new) and then compare the output of both functions. If the resulting state is 
the same then I haven't added any new bugs. =)

e.g. https://github.com/ThomasNeumann/setup-storage/blob/master/lib/FAI.pm, 
lines 99-121

bye
thomas


More information about the linux-fai mailing list