Always run set_disk_list before setup-storage

Alex Kiousis alexkiousis at
Thu Apr 30 12:00:44 CEST 2015

we have a lot of hp machines that we use to provision Debian on with
FAI. HP raid controllers use the hpacucli utility to manage their raid
controller and we use hpacuscripting from the partition hook to load
up a preset config for the controller.

My understanding of how FAI does the partitioning is this: after the
live system boots up, fai runs set_disk_info to populate the $disklist
variable with the available disk devices.  Then it runs the task in
order until it reaches task_partition. It first calls any partition
hook available and then runs setup-storage. If at this point there is
no $disklist variable, setup-storage itself calls set_disk_info.

Also because the hooks are executed in a sub-shell, we can't run
set_disk_info in the hook because the changed value of the variable is
discarded after the script exits.

The HP controller has a weird behavior (reproducible) that when it
boots a system with no raid configuration, it auto-creates a raid
volume with the first disks available. So because of that, FAI always
boots with $disklist = "sda". And because of the subshell thing we
can't change the disklist variable from the hook.

We managed to workaround this problem by hardcoding a set_disk_info
call on the task_partition subroutine just before setup-storage runs.
We think setup-storage should always call set_disk_info when invoked,
in order to see any disk changes made by the partition hook.

More information about the linux-fai mailing list