theforeman / community-templates

A place to share templates for various OSes for Foreman's provisioning
GNU General Public License v3.0
144 stars 182 forks source link

Fixes #29952 - make Grub2 template bootdisk-efi compatible #738

Closed lzap closed 4 years ago

lzap commented 4 years ago

The BOOTIF statement breaks the full host disk. It cannot be set to BOOTIF=01-$mac_default_net because when not PXE/HTTP booting, this variable is NOT set in grub, therefore it renders to BOOTIF=01- which is wrong and dracut cannot initialize the network.

Do not merge yet, testing with @adamruzicka for the latest bootdisk UEFI changes.

ekohl commented 4 years ago

It feels like there's something missing in the PR title. Prevent what?

lzap commented 4 years ago

Ameded all your remarks. Also modified the workaround "HTTP Boot" so it actually works with bootdisk. Since network root prefix does not get carried over, this is needed to be used, either HTTP or HTTPS option must be selected manually or via parameter.

@ekohl I will update the title to match the changes

lzap commented 4 years ago

Pushed, the absolute addressing must be kept because of another grub bug discovered moments ago, so I have added links to both bugs (one is fixed already, one is new - from today).

lzap commented 4 years ago

Last minor change which I missed since I was testing with an IP and not hostname:

diff --git a/app/views/foreman_bootdisk/generic_efi_host.erb b/app/views/foreman_bootdisk/generic_efi_host.erb
index 07f243a..b798d2e 100644
--- a/app/views/foreman_bootdisk/generic_efi_host.erb
+++ b/app/views/foreman_bootdisk/generic_efi_host.erb
@@ -16,6 +16,7 @@ echo " * HTTP ONLY (change the template for HTTPS)"
 echo " * ISC DHCP (other servers not tested)"
 echo " * GRUB FROM RHEL 8.3+/7.9+ (when generating the image)"
 echo " * EFI HTTP or HTTPS grub entry must be selected in menu"
+echo " * DNS must resolve proxy hostname via DNS proxy if set"
 echo "*******************************************************"
 sleep 5
 <%
@@ -26,8 +27,9 @@ proxy_proto = "http"
 @subnet.httpboot? || bootdisk_raise("Requires a proxy with httpboot feature")
 @subnet.template? || bootdisk_raise("Requires a proxy with template feature")
 proxy_port = @subnet.httpboot.setting(:HTTPBoot, "#{proxy_proto}_port") || bootdisk_raise("Requires proxy with #{proxy_proto}_port exposed setting")
-proxy_httpboot_host = @subnet.httpboot.hostname
-proxy_template_host = @subnet.template.hostname
+# Workaround for "no DNS server configured" https://bugzilla.redhat.com/show_bug.cgi?id=1842509
+proxy_httpboot_host = dns_lookup(@subnet.httpboot.hostname)
+proxy_template_host = dns_lookup(@subnet.template.hostname)
 -%>
 echo
 net_ls_cards
adamruzicka commented 4 years ago

Thank you @lzap!

lzap commented 4 years ago