Merge "Don't run os-prober from grub2-mkconfig"

This commit is contained in:
Zuul 2020-11-01 12:27:07 +00:00 committed by Gerrit Code Review
commit d84e88769e
5 changed files with 49 additions and 11 deletions

View File

@ -658,13 +658,13 @@ def _install_grub2(device, root_uuid, efi_system_part_uuid=None,
r'GRUB_CMDLINE_LINUX="\1 %s"'
% " ".join(rd_md_uuids),
contents))
# Generate the grub configuration file
utils.execute('chroot %(path)s /bin/sh -c '
'"%(bin)s-mkconfig -o '
'/boot/%(bin)s/grub.cfg"' %
{'path': path, 'bin': binary_name}, shell=True,
env_variables={'PATH': path_variable})
env_variables={'PATH': path_variable,
'GRUB_DISABLE_OS_PROBER': 'true'},
use_standard_locale=True)
LOG.info("GRUB2 successfully installed on %s", device)

View File

@ -381,6 +381,7 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
expected = [mock.call('efibootmgr', '--version')]
mock_execute.assert_has_calls(expected)
@mock.patch.object(os.path, 'exists', lambda *_: True)
@mock.patch.object(image, '_is_bootloader_loaded', lambda *_: False)
@mock.patch.object(hardware, 'is_md_device', autospec=True)
@mock.patch.object(hardware, 'md_get_raid_devices', autospec=True)
@ -409,16 +410,18 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
env_variables={
'PATH': '/sbin:/bin:/usr/sbin:/sbin'}),
mock.call(('chroot %s /bin/sh -c '
'"grub-install %s"' %
'"grub2-install %s"' %
(self.fake_dir, self.fake_dev)), shell=True,
env_variables={
'PATH': '/sbin:/bin:/usr/sbin:/sbin'}),
mock.call(('chroot %s /bin/sh -c '
'"grub-mkconfig -o '
'/boot/grub/grub.cfg"' % self.fake_dir),
'"grub2-mkconfig -o '
'/boot/grub2/grub.cfg"' % self.fake_dir),
shell=True,
env_variables={
'PATH': '/sbin:/bin:/usr/sbin:/sbin'}),
'PATH': '/sbin:/bin:/usr/sbin:/sbin',
'GRUB_DISABLE_OS_PROBER': 'true'},
use_standard_locale=True),
mock.call(('chroot %s /bin/sh -c "umount -a -t vfat"' %
(self.fake_dir)), shell=True,
env_variables={
@ -478,7 +481,9 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
'/boot/grub/grub.cfg"' % self.fake_dir),
shell=True,
env_variables={
'PATH': '/sbin:/bin:/usr/sbin:/sbin'}),
'PATH': '/sbin:/bin:/usr/sbin:/sbin',
'GRUB_DISABLE_OS_PROBER': 'true'},
use_standard_locale=True),
mock.call(('chroot %s /bin/sh -c "umount -a -t vfat"' %
(self.fake_dir)), shell=True,
env_variables={
@ -556,7 +561,9 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
'/boot/grub/grub.cfg"' % self.fake_dir),
shell=True,
env_variables={
'PATH': '/sbin:/bin:/usr/sbin:/sbin'}),
'PATH': '/sbin:/bin:/usr/sbin:/sbin',
'GRUB_DISABLE_OS_PROBER': 'true'},
use_standard_locale=True),
mock.call('umount', self.fake_dir + '/boot/efi',
attempts=3, delay_on_retry=True),
mock.call(('chroot %s /bin/sh -c "umount -a -t vfat"' %
@ -963,7 +970,9 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
'/boot/grub/grub.cfg"' % self.fake_dir),
shell=True,
env_variables={
'PATH': '/sbin:/bin:/usr/sbin:/sbin'}),
'PATH': '/sbin:/bin:/usr/sbin:/sbin',
'GRUB_DISABLE_OS_PROBER': 'true'},
use_standard_locale=True),
mock.call('umount', self.fake_dir + '/boot/efi',
attempts=3, delay_on_retry=True),
mock.call(('chroot %s /bin/sh -c "umount -a -t vfat"' %
@ -1055,7 +1064,9 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
'/boot/grub/grub.cfg"' % self.fake_dir),
shell=True,
env_variables={
'PATH': '/sbin:/bin:/usr/sbin:/sbin'}),
'PATH': '/sbin:/bin:/usr/sbin:/sbin',
'GRUB_DISABLE_OS_PROBER': 'true'},
use_standard_locale=True),
mock.call(('chroot %s /bin/sh -c "umount -a -t vfat"' %
(self.fake_dir)), shell=True,
env_variables={

View File

@ -0,0 +1,11 @@
---
fixes:
- |
Fixes an issue where deployments of Fedora or Centos can hang when
using grub2 with the execution of the ``grub2-mkconfig`` command
not returning before the deployment process times out. This is
because ``grub2-mkconfig`` triggers ``os-prober`` which can
take an extended period of time to evaluate additional unrelated
devices for dual-boot scenarios. Since operators are not dual
booting their machines enrolled in ironic, it seems like an
un-necessary scan and has thus been disabled.

View File

@ -145,6 +145,20 @@
IRONIC_AUTOMATED_CLEAN_ENABLED: False
IRONIC_BUILD_DEPLOY_RAMDISK: True
# This job will superceed the above centos7 metalsmith integration job
- job:
name: metalsmith-integration-ipa-src-uefi
parent: metalsmith-integration-glance-localboot-centos8-uefi
required-projects:
- openstack/ironic-python-agent
- openstack/ironic-python-agent-builder
- openstack/ironic-lib
vars:
devstack_localrc:
# Don't waste time on cleaning, it's checked everywhere else
IRONIC_AUTOMATED_CLEAN_ENABLED: False
IRONIC_BUILD_DEPLOY_RAMDISK: True
# used by ironic-python-agent-builder
- job:
name: ipa-tempest-bios-ipmi-direct-tinyipa-src

View File

@ -22,6 +22,8 @@
- ironic-standalone-ipa-src:
voting: false
- metalsmith-integration-ipa-src
- metalsmith-integration-ipa-src-uefi:
voting: false
# NOTE(dtantsur): non-voting because IPA source code is very unlikely
# to break them. They rather serve as a canary for broken POST jobs.
- ironic-python-agent-check-image-tinyipa: