From 5110a6558149e922911055808e9210cc476579eb Mon Sep 17 00:00:00 2001 From: Lucas Alvares Gomes Date: Thu, 8 Sep 2016 12:39:31 +0100 Subject: [PATCH] Grub2 by default for PXE + UEFI This patch is changing the default bootloader for PXE + UEFI to Grub2. Prior to this patch Elilo was the default but, Elilo is no longer maintained with the last release dating 2014. Ironic should have sane defaults therefore we should not rely on an unmaintained project. Change-Id: Ib34fcbd37e4698bf272582c96b1540b511b5a892 --- doc/source/deploy/install-guide.rst | 56 +++++++++++-------- etc/ironic/ironic.conf.sample | 4 +- ironic/conf/pxe.py | 4 +- ironic/tests/unit/common/test_pxe_utils.py | 14 ++++- ...efi-grub2-by-default-6b797a9e690d2dd5.yaml | 7 +++ 5 files changed, 55 insertions(+), 30 deletions(-) create mode 100644 releasenotes/notes/uefi-grub2-by-default-6b797a9e690d2dd5.yaml diff --git a/doc/source/deploy/install-guide.rst b/doc/source/deploy/install-guide.rst index 1ed12d8b81..6b1d10d95a 100644 --- a/doc/source/deploy/install-guide.rst +++ b/doc/source/deploy/install-guide.rst @@ -968,17 +968,7 @@ PXE UEFI setup If you want to deploy on a UEFI supported bare metal, perform these additional steps on the ironic conductor node to configure the PXE UEFI environment. -#. Download and untar the elilo bootloader version >= 3.16 from - http://sourceforge.net/projects/elilo/:: - - sudo tar zxvf elilo-3.16-all.tar.gz - -#. Copy the elilo boot loader image to ``/tftpboot`` directory:: - - sudo cp ./elilo-3.16-x86_64.efi /tftpboot/elilo.efi - -#. Grub2 is an alternate UEFI bootloader supported in Bare Metal service. - Install grub2 and shim packages:: +#. Install Grub2 and shim packages:: Ubuntu: (14.04LTS and later) sudo apt-get install grub-efi-amd64-signed shim-signed @@ -1028,18 +1018,6 @@ steps on the ironic conductor node to configure the PXE UEFI environment. sudo chmod 644 $GRUB_DIR/grub.cfg -#. Update bootfile and template file configuration parameters for UEFI PXE boot - in the Bare Metal Service's configuration file (/etc/ironic/ironic.conf):: - - [pxe] - - # Bootfile DHCP parameter for UEFI boot mode. (string value) - uefi_pxe_bootfile_name=bootx64.efi - - # Template file for PXE configuration for UEFI boot loader. - # (string value) - uefi_pxe_config_template=$pybasedir/drivers/modules/pxe_grub_config.template - #. Update the bare metal node with ``boot_mode`` capability in node's properties field:: @@ -1052,7 +1030,37 @@ steps on the ironic conductor node to configure the PXE UEFI environment. boot device on the bare metal node. So this step is not required for ``pxe_ilo`` driver. -For more information on configuring boot modes, refer boot_mode_support_. +.. note:: + For more information on configuring boot modes, see boot_mode_support_. + + +Elilo: an alternative to Grub2 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Elilo is a UEFI bootloader. It is an alternative to Grub2, although it +isn't recommended since it is not being supported. + +#. Download and untar the elilo bootloader version >= 3.16 from + http://sourceforge.net/projects/elilo/:: + + sudo tar zxvf elilo-3.16-all.tar.gz + +#. Copy the elilo boot loader image to ``/tftpboot`` directory:: + + sudo cp ./elilo-3.16-x86_64.efi /tftpboot/elilo.efi + +#. Update bootfile and template file configuration parameters for UEFI + PXE boot in the Bare Metal Service's configuration file + (/etc/ironic/ironic.conf):: + + [pxe] + + # Bootfile DHCP parameter for UEFI boot mode. (string value) + uefi_pxe_bootfile_name=elilo.efi + + # Template file for PXE configuration for UEFI boot loader. + # (string value) + uefi_pxe_config_template=$pybasedir/drivers/modules/elilo_efi_pxe_config.template iPXE setup diff --git a/etc/ironic/ironic.conf.sample b/etc/ironic/ironic.conf.sample index 5a2815c0c5..c8c8e3e5ea 100644 --- a/etc/ironic/ironic.conf.sample +++ b/etc/ironic/ironic.conf.sample @@ -2721,7 +2721,7 @@ # On ironic-conductor node, template file for PXE # configuration for UEFI boot loader. (string value) -#uefi_pxe_config_template = $pybasedir/drivers/modules/elilo_efi_pxe_config.template +#uefi_pxe_config_template = $pybasedir/drivers/modules/pxe_grub_config.template # IP address of ironic-conductor node's TFTP server. (string # value) @@ -2740,7 +2740,7 @@ #pxe_bootfile_name = pxelinux.0 # Bootfile DHCP parameter for UEFI boot mode. (string value) -#uefi_pxe_bootfile_name = elilo.efi +#uefi_pxe_bootfile_name = bootx64.efi # Enable iPXE boot. (boolean value) #ipxe_enabled = false diff --git a/ironic/conf/pxe.py b/ironic/conf/pxe.py index 7e16724eca..22e6b0fc93 100644 --- a/ironic/conf/pxe.py +++ b/ironic/conf/pxe.py @@ -55,7 +55,7 @@ opts = [ cfg.StrOpt('uefi_pxe_config_template', default=os.path.join( '$pybasedir', - 'drivers/modules/elilo_efi_pxe_config.template'), + 'drivers/modules/pxe_grub_config.template'), help=_('On ironic-conductor node, template file for PXE ' 'configuration for UEFI boot loader.')), cfg.StrOpt('tftp_server', @@ -77,7 +77,7 @@ opts = [ default='pxelinux.0', help=_('Bootfile DHCP parameter.')), cfg.StrOpt('uefi_pxe_bootfile_name', - default='elilo.efi', + default='bootx64.efi', help=_('Bootfile DHCP parameter for UEFI boot mode.')), cfg.BoolOpt('ipxe_enabled', default=False, diff --git a/ironic/tests/unit/common/test_pxe_utils.py b/ironic/tests/unit/common/test_pxe_utils.py index 5b4f4b207f..e35992fb8a 100644 --- a/ironic/tests/unit/common/test_pxe_utils.py +++ b/ironic/tests/unit/common/test_pxe_utils.py @@ -175,6 +175,11 @@ class TestPXEUtils(db_base.DbTestCase): def test__build_elilo_config(self): pxe_opts = self.pxe_options pxe_opts['boot_mode'] = 'uefi' + self.config( + uefi_pxe_config_template=('ironic/drivers/modules/' + 'elilo_efi_pxe_config.template'), + group='pxe' + ) rendered_template = pxe_utils._build_pxe_config( pxe_opts, CONF.pxe.uefi_pxe_config_template, '{{ ROOT }}', '{{ DISK_IDENTIFIER }}') @@ -189,9 +194,9 @@ class TestPXEUtils(db_base.DbTestCase): pxe_opts = self.pxe_options pxe_opts['boot_mode'] = 'uefi' pxe_opts['tftp_server'] = '192.0.2.1' - grub_tmplte = "ironic/drivers/modules/pxe_grub_config.template" rendered_template = pxe_utils._build_pxe_config( - pxe_opts, grub_tmplte, '(( ROOT ))', '(( DISK_IDENTIFIER ))') + pxe_opts, CONF.pxe.uefi_pxe_config_template, + '(( ROOT ))', '(( DISK_IDENTIFIER ))') template_file = 'ironic/tests/unit/drivers/pxe_grub_config.template' expected_template = open(template_file).read().rstrip() @@ -335,6 +340,11 @@ class TestPXEUtils(db_base.DbTestCase): @mock.patch('oslo_utils.fileutils.ensure_tree', autospec=True) def test_create_pxe_config_uefi_elilo(self, ensure_tree_mock, build_mock, write_mock, link_ip_configs_mock): + self.config( + uefi_pxe_config_template=('ironic/drivers/modules/' + 'elilo_efi_pxe_config.template'), + group='pxe' + ) build_mock.return_value = self.pxe_options_uefi with task_manager.acquire(self.context, self.node.uuid) as task: task.node.properties['capabilities'] = 'boot_mode:uefi' diff --git a/releasenotes/notes/uefi-grub2-by-default-6b797a9e690d2dd5.yaml b/releasenotes/notes/uefi-grub2-by-default-6b797a9e690d2dd5.yaml new file mode 100644 index 0000000000..1d4aa978b5 --- /dev/null +++ b/releasenotes/notes/uefi-grub2-by-default-6b797a9e690d2dd5.yaml @@ -0,0 +1,7 @@ +--- +upgrade: + - The default bootloader for PXE + UEFI has changed from ELILO to Grub2 + because ELILO is not being actively developed anymore. Operators relying + on ELILO should explicitly set the ``[pxe]/uefi_pxe_bootfile_name`` + and ``[pxe]/uefi_pxe_config_template`` configuration options to the + ELILO ROM and configuration template.