Merge "Install grub in the EFI "Fallback path""

This commit is contained in:
Jenkins 2016-10-20 16:18:49 +00:00 committed by Gerrit Code Review
commit c393214528
3 changed files with 27 additions and 0 deletions

View File

@ -118,6 +118,19 @@ def _install_grub2(device, root_uuid, efi_system_part_uuid=None):
'"/usr/sbin/%(bin)s-install %(dev)s"' % '"/usr/sbin/%(bin)s-install %(dev)s"' %
{'path': path, 'bin': binary_name, 'dev': device}, {'path': path, 'bin': binary_name, 'dev': device},
shell=True, env_variables={'PATH': path_variable}) shell=True, env_variables={'PATH': path_variable})
# Also run grub-install with --removable, this installs grub to the
# EFI fallback path. Useful if the NVRAM wasn't written correctly,
# was reset or if testing with virt as libvirt resets the NVRAM
# on instance start.
# This operation is essentially a copy operation. Use of the
# --removable flag, per the grub-install source code changes
# the default file to be copied, destination file name, and
# prevents NVRAM from being updated.
if efi_partition:
utils.execute('chroot %(path)s /bin/bash -c '
'"/usr/sbin/%(bin)s-install %(dev)s --removable"' %
{'path': path, 'bin': binary_name, 'dev': device},
shell=True, env_variables={'PATH': path_variable})
# Generate the grub configuration file # Generate the grub configuration file
utils.execute('chroot %(path)s /bin/bash -c ' utils.execute('chroot %(path)s /bin/bash -c '

View File

@ -137,6 +137,10 @@ class TestImageExtension(test_base.BaseTestCase):
'"/usr/sbin/grub-install %s"' % '"/usr/sbin/grub-install %s"' %
(self.fake_dir, self.fake_dev)), shell=True, (self.fake_dir, self.fake_dev)), shell=True,
env_variables={'PATH': '/sbin:/bin'}), env_variables={'PATH': '/sbin:/bin'}),
mock.call(('chroot %s /bin/bash -c '
'"/usr/sbin/grub-install %s --removable"' %
(self.fake_dir, self.fake_dev)), shell=True,
env_variables={'PATH': '/sbin:/bin'}),
mock.call(('chroot %s /bin/bash -c ' mock.call(('chroot %s /bin/bash -c '
'"/usr/sbin/grub-mkconfig -o ' '"/usr/sbin/grub-mkconfig -o '
'/boot/grub/grub.cfg"' % self.fake_dir), '/boot/grub/grub.cfg"' % self.fake_dir),
@ -193,6 +197,10 @@ class TestImageExtension(test_base.BaseTestCase):
'"/usr/sbin/grub-install %s"' % '"/usr/sbin/grub-install %s"' %
(self.fake_dir, self.fake_dev)), shell=True, (self.fake_dir, self.fake_dev)), shell=True,
env_variables={'PATH': '/sbin:/bin'}), env_variables={'PATH': '/sbin:/bin'}),
mock.call(('chroot %s /bin/bash -c '
'"/usr/sbin/grub-install %s --removable"' %
(self.fake_dir, self.fake_dev)), shell=True,
env_variables={'PATH': '/sbin:/bin'}),
mock.call(('chroot %s /bin/bash -c ' mock.call(('chroot %s /bin/bash -c '
'"/usr/sbin/grub-mkconfig -o ' '"/usr/sbin/grub-mkconfig -o '
'/boot/grub/grub.cfg"' % self.fake_dir), '/boot/grub/grub.cfg"' % self.fake_dir),

View File

@ -0,0 +1,6 @@
---
fixes:
- The ironic-python-agent when writing a partition image now
installs grub to the UEFI fallback path. e.g. EFI/BOOT/BOOTX64.EFI
The fallback path is used to boot the bare metal node if the NVRAM is
reset.