dracutdevs / dracut

dracut the event driven initramfs infrastructure
https://github.com/dracutdevs/dracut/wiki
GNU General Public License v2.0
599 stars 397 forks source link

Improve boot time by sending DHCP only on min BDF device #850

Closed anjalidk closed 3 years ago

anjalidk commented 4 years ago

On some servers and bare metal instances, there are 2 ethernet devices, on which DHCP is sent. However, if only first one succeeds, the second one keeps re-trying DHCP, adding almost a minute to the boot time, before failing. This patch sends DHCP only for the minimum BDF device. Once successful, DHCP is not sent on any other DHCP device. This is enabled only when we add ip=single-dhcp in kernel command parameters. If the DHCP fails on minimum BDF device for some reason, we keep note of this failed device in /run/initramfs/dhcpfaildev. This will ensure correctness for the case when the first device passed to ifup.sh was the minimum BDF, but it failed; then subsequent calls to ifup.sh for other devices will skip using the minimum BDF device for sending DHCP, and choose another device. This patch gives an improvement of about 1 minute to the system bootup time

haraldh commented 4 years ago

which patch?

anjalidk commented 4 years ago

Sorry for the delay, here is the patch:

On some servers and bare metal instances, when there are 2 ethernet devices, on which DHCP is sent,but only first one succeeds (the one for the minimum BDF device, then this adds almost a minute to boot times. The second one keeps re-trying DHCP, hence adding the minute to the bootup time, before failing. This patch sends DHCP only for the minimum BDF device. Once successful, DHCP is not sent on any other DHCP device. This is enabled only when we add ip=single-dhcp in kernel command parameters. If the DHCP fails on minimum BDF device for some reason, we keep note of this failed device in /run/initramfs/dhcpfaildev. This will ensure correctness for the case when the first device passed to ifup.sh was the minimum BDF, but it failed; then subsequent calls to ifup.sh for other devices will skip using the minimum BDF device for sending DHCP, and choose another device. This patch gives an improvement of about 1 minute to the system bootup time

Signed-off-by: Anjali Kulkarnianjali.k.kulkarni@oracle.com

diff -up ./modules.d/35network-legacy/ifup.sh.orig ./modules.d/35network-legacy/ifup.sh --- ./modules.d/35network-legacy/ifup.sh.orig 2020-05-21 10:36:35.197226594 -0700 +++ ./modules.d/35network-legacy/ifup.sh 2020-06-04 16:00:59.170307526 -0700 @@ -23,6 +23,75 @@ if [ "$netif" = "lo" ] ; then exit 0 fi

+min_device="" +DHCP_FAIL="/run/initramfs/dhcpfaildev" +UDEVLOG="/run/initramfs/udevlog" + +min_bdf_device() {

On 7/3/20 00:24, Harald Hoyer wrote:

which patch?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://urldefense.com/v3/__https://github.com/dracutdevs/dracut/issues/850*issuecomment-653396125__;Iw!!GqivPVa7Brio!OYfL_eysGlK9ImOm2HYNihY8J3Y1B1Ix3EkWu_wQrqjGrAhZl8AS10XwREQXsorWjTky_A$, or unsubscribe https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AQE6QX4DNE7EQZ3QMLTDONDRZWBUNANCNFSM4OPESBMA__;!!GqivPVa7Brio!OYfL_eysGlK9ImOm2HYNihY8J3Y1B1Ix3EkWu_wQrqjGrAhZl8AS10XwREQXsooF01bGMQ$.

haraldh commented 4 years ago

Please file this as a pull request.

https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request