Closed anjalidk closed 3 years ago
which patch?
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
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() {
+do_single_dhcp() {
do_dhcp() {
@@ -432,6 +501,8 @@ for p in $(getargs ip=); do case $autoopt in dhcp|on|any) do_dhcp -4 ;;
#
-# ip=[dhcp|on|any] +# ip=[dhcp|on|any|single-dhcp] #
# @@ -77,7 +77,7 @@ for p in $(getargs ip=); do ;; auto6);; either6);;
dhcp|dhcp6|on|any|single-dhcp) \ [ -n "$NEEDBOOTDEV" ] && [ -z "$dev" ] && \ die "Sorry, 'ip=$p' does not make sense for multiple interface configurations"
[ -n "$ip" ] && \
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$.
Please file this as a pull request.
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