[CentOS] kickstart %pre vda/sda troubles

Sat Mar 9 22:38:30 UTC 2013
Natxo Asenjo <natxo.asenjo at gmail.com>

hi,

The problem: for kvm/qemu disks are /dev/vdx devices when using the
virtio driver. For vmware, drives are /dev/sdx devices. For hp
servers, /dev/ccisss/whatever (sorry, no proliant with an array
controller handy to check it).

in order to just have one kickstart script to maintain I am trying to
use the %pre section but getting a bit stuck. This is what I have:

%pre
if [ -b /dev/sda ]
then
    zerombr
    clearpart --all
    bootloader --location=mbr --timeout=0 --driveorder=sda
--append="crashkernel=auto rhgb quiet"
    part /boot --fstype=ext4 --size=500
    part pv.008002 --grow --size=1
    volgroup vg_host --pesize=4096 pv.008002
    logvol / --fstype=ext4 --name=lv_root --vgname=vg_host --grow
--size=1024 --maxsize=51200
    logvol swap --name=lv_swap --vgname=vg_host --grow --size=512 --maxsize=1024
fi
elif [ -b /dev/vda ]
then
    zerombr
    clearpart --all
    bootloader --location=mbr --timeout=0 --driveorder=vda
--append="crashkernel=auto rhgb quiet"
    clearpart --linux --drives=vda
    part /boot --fstype=ext4 --size=500 --ondisk=vda
    part pv.008002 --grow --size=1 --ondisk=vda
    volgroup vg_host --pesize=4096 pv.008002
    logvol / --fstype=ext4 --name=lv_root --vgname=vg_host --grow
--size=1024 --recommended
    logvol swap --name=lv_swap --vgname=vg_host --grow --size=512 --maxsize=1024
fi
else
    echo unknown disk
fi

But when kickstarting a guest on a kvm host, I get this error:

the kickstart configuration file is missing required information that
anaconda cannot promtp for. Please add the following sections and try
again: Bootloader configuration.

If I swith to another virtual terminal, I see this: Device vda not
found. But it's there, I can see it with ls -l, it is a block device

Has anybody implemented something like this and is willing to share it?

TIA,
--
Groeten,
natxo