metal/bsp-files/kickstarts/pre_disk_storage.cfg
Ovidiu Poncea 9b5148e3b5 Harden kickstarts as udev behavior can lead to random failures
Whenever a dev node that is not in use is opened with open(O_RDWR)
udev triggers a flush in devtmpfs that briefly remove & recreate all
the nodes for partitions on that device. This leads to commands
accessing dev nodes during the flush to fail. In our case blkid and
lsblk failed.

These failures are hard to reproduce, have devastating effect on
the partitioning operations and are not solved by using 'udevadm settle'
as some of the kernel events are asynchronous.

So, mainly, this commit stops udev from messing up with /dev nodes by
initializing file descriptors for all storage devices then opening
locks on them with flock. Setting locks stops udev triggering kernel
partition rescan.

Locks are set at the start of the partitioning operation and
released at the end.

For more details and similar cases see:
 o 02ba8fb335
 o http://tracker.ceph.com/issues/14080
 o http://tracker.ceph.com/issues/15176

This commit:
 o stops udev messing up with /dev nodes;
 o aborts install on critical failures;
 o adds retry for critical operations such as LVM cleanup or
   partition removal and creation.

Closes-Bug: 1888938
Change-Id: Iaaaaaae973ee36f2c4bfd42c327e8c6278d59303
Signed-off-by: Ovidiu Poncea <ovidiu.poncea@windriver.com>
2020-07-28 16:14:28 +00:00

44 lines
1.3 KiB
INI
Executable File

sz=$(blockdev --getsize64 $rootfs_device)
if [ $sz -le $((90*$gb)) ] ; then
LOG_VOL_SIZE=4000
SCRATCH_VOL_SIZE=4000
ROOTFS_SIZE=10000
else
LOG_VOL_SIZE=8000
SCRATCH_VOL_SIZE=8000
ROOTFS_SIZE=20000
fi
ROOTFS_OPTIONS="defaults"
profile_mode=`cat /proc/cmdline |xargs -n1 echo |grep security_profile= | grep extended`
if [ -n "$profile_mode" ]; then
# Enable iversion labelling for rootfs when IMA is enabled
ROOTFS_OPTIONS="${ROOTFS_OPTIONS},iversion"
fi
cat<<EOF>>/tmp/part-include
clearpart --all --drives=$WIPE_HDD --initlabel
EOF
if [ -d /sys/firmware/efi ] ; then
cat<<EOF>>/tmp/part-include
part /boot/efi --fstype=efi --size=300 --ondrive=$boot_device
EOF
else
cat<<EOF>>/tmp/part-include
part biosboot --asprimary --fstype=biosboot --size=1 --ondrive=$boot_device
EOF
fi
cat<<EOF>>/tmp/part-include
part /boot --fstype=ext4 --asprimary --size=500 --ondrive=$rootfs_device --fsoptions="$ROOTFS_OPTIONS"
part pv.253004 --grow --asprimary --size=500 --ondrive=$rootfs_device
volgroup cgts-vg --pesize=32768 pv.253004
logvol /var/log --fstype=ext4 --vgname=cgts-vg --size=$LOG_VOL_SIZE --name=log-lv
logvol /scratch --fstype=ext4 --vgname=cgts-vg --size=$SCRATCH_VOL_SIZE --name=scratch-lv
part / --fstype=ext4 --asprimary --size=$ROOTFS_SIZE --ondrive=$rootfs_device --fsoptions="$ROOTFS_OPTIONS"
EOF