Revision 7a77b3ce
Added by Bernhard Suttner 27 days ago
app/views/unattended/provisioning_templates/snippet/pxegrub2_chainload.erb | ||
---|---|---|
insmod chain
|
||
|
||
echo "VMWare hosts with QuickBoot feature enabled may not find the local ESP"
|
||
echo "partition due to not initializing all the EFI devices. To workaround, upgrade"
|
||
echo "to the latest grub2 (*) and uncomment "connectefi scsi" statement in the"
|
||
echo "grub2_chainload template."
|
||
echo "partition due to not initializing all the EFI devices. To address this,"
|
||
echo "use an up-to-date grub2 (*) version and include the "connectefi scsi" statement"
|
||
echo "as provided below. If you're using an older grub2 version or"
|
||
echo "the "connectefi" option isn't recognized by your grub2, grub2 will print a error"
|
||
echo "like 'can't find command connectefi' but the boot process will continue."
|
||
echo "For hosts, you can omit this by adding a (global) parameter to 'grub2-connectefi=false'."
|
||
echo "For the default GRUB2 script, you can omit this by setting the"
|
||
echo "default_connectefi_option below to 'false'."
|
||
echo "Valid values of 'grub2-connectefi' parameter: false, scsi, pciroot"
|
||
echo
|
||
echo "Virtual or physical hosts using Software RAID for the ESP partition may try"
|
||
echo "booting on the Software RAID, which will fail. To workaround, upgrade to the"
|
||
... | ... | |
echo
|
||
echo "(*) grub2-efi-x64-2.02-122.el8 (upstream doesn't have the patches yet)"
|
||
echo
|
||
#connectefi scsi
|
||
<%=
|
||
default_connectefi_option = 'scsi'
|
||
connectefi_option = @host ? host_param('grub2-connectefi', default_connectefi_option) : default_connectefi_option
|
||
connectefi_option = nil if connectefi_option == 'false'
|
||
"connectefi #{connectefi_option}" if connectefi_option
|
||
%>
|
||
|
||
menuentry 'Chainload Grub2 EFI from ESP' --id local_chain_hd0 {
|
||
echo "Chainloading Grub2 EFI from ESP, enabled devices for booting:"
|
test/unit/foreman/renderer/snapshots/ProvisioningTemplate/PXEGrub2/PXEGrub2_default_local_boot.host4dhcp.snap.txt | ||
---|---|---|
insmod chain
|
||
|
||
echo "VMWare hosts with QuickBoot feature enabled may not find the local ESP"
|
||
echo "partition due to not initializing all the EFI devices. To workaround, upgrade"
|
||
echo "to the latest grub2 (*) and uncomment "connectefi scsi" statement in the"
|
||
echo "grub2_chainload template."
|
||
echo "partition due to not initializing all the EFI devices. To address this,"
|
||
echo "use an up-to-date grub2 (*) version and include the "connectefi scsi" statement"
|
||
echo "as provided below. If you're using an older grub2 version or"
|
||
echo "the "connectefi" option isn't recognized by your grub2, grub2 will print a error"
|
||
echo "like 'can't find command connectefi' but the boot process will continue."
|
||
echo "For hosts, you can omit this by adding a (global) parameter to 'grub2-connectefi=false'."
|
||
echo "For the default GRUB2 script, you can omit this by setting the"
|
||
echo "default_connectefi_option below to 'false'."
|
||
echo "Valid values of 'grub2-connectefi' parameter: false, scsi, pciroot"
|
||
echo
|
||
echo "Virtual or physical hosts using Software RAID for the ESP partition may try"
|
||
echo "booting on the Software RAID, which will fail. To workaround, upgrade to the"
|
||
... | ... | |
echo
|
||
echo "(*) grub2-efi-x64-2.02-122.el8 (upstream doesn't have the patches yet)"
|
||
echo
|
||
#connectefi scsi
|
||
connectefi scsi
|
||
|
||
menuentry 'Chainload Grub2 EFI from ESP' --id local_chain_hd0 {
|
||
echo "Chainloading Grub2 EFI from ESP, enabled devices for booting:"
|
test/unit/foreman/renderer/snapshots/ProvisioningTemplate/PXEGrub2/PXEGrub2_global_default.host4dhcp.snap.txt | ||
---|---|---|
insmod chain
|
||
|
||
echo "VMWare hosts with QuickBoot feature enabled may not find the local ESP"
|
||
echo "partition due to not initializing all the EFI devices. To workaround, upgrade"
|
||
echo "to the latest grub2 (*) and uncomment "connectefi scsi" statement in the"
|
||
echo "grub2_chainload template."
|
||
echo "partition due to not initializing all the EFI devices. To address this,"
|
||
echo "use an up-to-date grub2 (*) version and include the "connectefi scsi" statement"
|
||
echo "as provided below. If you're using an older grub2 version or"
|
||
echo "the "connectefi" option isn't recognized by your grub2, grub2 will print a error"
|
||
echo "like 'can't find command connectefi' but the boot process will continue."
|
||
echo "For hosts, you can omit this by adding a (global) parameter to 'grub2-connectefi=false'."
|
||
echo "For the default GRUB2 script, you can omit this by setting the"
|
||
echo "default_connectefi_option below to 'false'."
|
||
echo "Valid values of 'grub2-connectefi' parameter: false, scsi, pciroot"
|
||
echo
|
||
echo "Virtual or physical hosts using Software RAID for the ESP partition may try"
|
||
echo "booting on the Software RAID, which will fail. To workaround, upgrade to the"
|
||
... | ... | |
echo
|
||
echo "(*) grub2-efi-x64-2.02-122.el8 (upstream doesn't have the patches yet)"
|
||
echo
|
||
#connectefi scsi
|
||
connectefi scsi
|
||
|
||
menuentry 'Chainload Grub2 EFI from ESP' --id local_chain_hd0 {
|
||
echo "Chainloading Grub2 EFI from ESP, enabled devices for booting:"
|
test/unit/foreman/renderer/snapshots/ProvisioningTemplate/snippet/pxegrub2_chainload.host4dhcp.snap.txt | ||
---|---|---|
insmod chain
|
||
|
||
echo "VMWare hosts with QuickBoot feature enabled may not find the local ESP"
|
||
echo "partition due to not initializing all the EFI devices. To workaround, upgrade"
|
||
echo "to the latest grub2 (*) and uncomment "connectefi scsi" statement in the"
|
||
echo "grub2_chainload template."
|
||
echo "partition due to not initializing all the EFI devices. To address this,"
|
||
echo "use an up-to-date grub2 (*) version and include the "connectefi scsi" statement"
|
||
echo "as provided below. If you're using an older grub2 version or"
|
||
echo "the "connectefi" option isn't recognized by your grub2, grub2 will print a error"
|
||
echo "like 'can't find command connectefi' but the boot process will continue."
|
||
echo "For hosts, you can omit this by adding a (global) parameter to 'grub2-connectefi=false'."
|
||
echo "For the default GRUB2 script, you can omit this by setting the"
|
||
echo "default_connectefi_option below to 'false'."
|
||
echo "Valid values of 'grub2-connectefi' parameter: false, scsi, pciroot"
|
||
echo
|
||
echo "Virtual or physical hosts using Software RAID for the ESP partition may try"
|
||
echo "booting on the Software RAID, which will fail. To workaround, upgrade to the"
|
||
... | ... | |
echo
|
||
echo "(*) grub2-efi-x64-2.02-122.el8 (upstream doesn't have the patches yet)"
|
||
echo
|
||
#connectefi scsi
|
||
connectefi scsi
|
||
|
||
menuentry 'Chainload Grub2 EFI from ESP' --id local_chain_hd0 {
|
||
echo "Chainloading Grub2 EFI from ESP, enabled devices for booting:"
|
test/unit/foreman/templates/snippets/pxegrub2_chainload_test.rb | ||
---|---|---|
require 'test_helper'
|
||
|
||
class PxeGrub2ChainloadTest < ActiveSupport::TestCase
|
||
def renderer
|
||
@renderer ||= Foreman::Renderer::SafeModeRenderer
|
||
end
|
||
|
||
def render_template(host)
|
||
@snippet ||= File.read(Rails.root.join('app', 'views', 'unattended', 'provisioning_templates', 'snippet', 'pxegrub2_chainload.erb'))
|
||
|
||
source = OpenStruct.new(
|
||
name: 'Test',
|
||
content: @snippet
|
||
)
|
||
|
||
scope = Class.new(Foreman::Renderer::Scope::Provisioning).send(
|
||
:new,
|
||
host: host,
|
||
source: source,
|
||
variables: {
|
||
host: host,
|
||
})
|
||
|
||
renderer.render(source, scope)
|
||
end
|
||
|
||
setup do
|
||
@host = FactoryBot.create(:host, :managed, :build => true)
|
||
end
|
||
|
||
test 'should render connectefi scsi option by default' do
|
||
actual = render_template(@host)
|
||
|
||
assert_match(/^ *connectefi scsi/, actual)
|
||
end
|
||
|
||
test 'should not render connectefi option if parameter false' do
|
||
FactoryBot.create(:host_parameter, host: @host, name: 'grub2-connectefi', value: 'false')
|
||
|
||
actual = render_template(@host)
|
||
|
||
assert_no_match(/^ *connectefi/, actual)
|
||
end
|
||
|
||
test 'should render connectefi option if parameter present' do
|
||
FactoryBot.create(:host_parameter, host: @host, name: 'grub2-connectefi', value: 'TESTOPT')
|
||
|
||
actual = render_template(@host)
|
||
|
||
assert_match(/^ *connectefi TESTOPT/, actual)
|
||
end
|
||
|
||
test 'should render connectefi option for default template' do
|
||
actual = render_template(nil)
|
||
|
||
assert_match(/^ *connectefi scsi/, actual)
|
||
end
|
||
end
|
Also available in: Unified diff
Fixes #36691 - use 'connectefi scsi' by default
Co-Authored-by: Shimon Shtein <sshtein@redhat.com>
Co-Authored-by: Ewoud Kohl van Wijngaarden <ewoud@kohlvanwijngaarden.nl>