Increase all the grub_timeout defaults to 10sec

This increases the timeout value and adds the ability in the
IPMI session to catch the moment and press a key to see the
grub menu to choose a different kernel.

Conflicts:

	bareon/utils/grub.py
	fuel_agent/tests/test_manager.py

Change-Id: I297c5a4d17606274d6f344c7dcbdcf44663984b2
Closes-Bug: #1540638
This commit is contained in:
Maksim Malchuk 2016-02-15 12:55:37 +03:00 committed by Alexander Gordeev
parent 58f03a5487
commit 1d843c4f6e
6 changed files with 15 additions and 19 deletions

View File

@ -27,8 +27,8 @@ from bareon.utils import utils
opts = [ opts = [
cfg.IntOpt( cfg.IntOpt(
'grub_timeout', 'timeout',
default=5, default=10,
help='Timeout in secs for GRUB' help='Timeout in secs for GRUB'
), ),
cfg.BoolOpt( cfg.BoolOpt(
@ -96,14 +96,14 @@ class BootLoaderAction(base.BaseAction, mixins.MountableMixin):
if grub.version == 1: if grub.version == 1:
gu.grub1_cfg(kernel=kernel, initrd=initrd, gu.grub1_cfg(kernel=kernel, initrd=initrd,
kernel_params=grub.kernel_params, chroot=chroot, kernel_params=grub.kernel_params, chroot=chroot,
grub_timeout=CONF.grub_timeout) grub_timeout=CONF.timeout)
gu.grub1_install(install_devices, boot_device, chroot=chroot) gu.grub1_install(install_devices, boot_device, chroot=chroot)
else: else:
# TODO(kozhukalov): implement which kernel to use by default # TODO(kozhukalov): implement which kernel to use by default
# Currently only grub1_cfg accepts kernel and initrd # Currently only grub1_cfg accepts kernel and initrd
# parameters. # parameters.
gu.grub2_cfg(kernel_params=grub.kernel_params, chroot=chroot, gu.grub2_cfg(kernel_params=grub.kernel_params, chroot=chroot,
grub_timeout=CONF.grub_timeout) grub_timeout=CONF.timeout)
gu.grub2_install(install_devices, chroot=chroot) gu.grub2_install(install_devices, chroot=chroot)
# TODO(agordeev): move to separate actions? # TODO(agordeev): move to separate actions?

View File

@ -53,11 +53,6 @@ opts = [
default='.bareon-image', default='.bareon-image',
help='Suffix which is used while creating temporary files', help='Suffix which is used while creating temporary files',
), ),
cfg.IntOpt(
'grub_timeout',
default=5,
help='Timeout in secs for GRUB'
),
cfg.IntOpt( cfg.IntOpt(
'max_loop_devices_count', 'max_loop_devices_count',
default=255, default=255,

View File

@ -67,7 +67,7 @@ class TestBootLoaderAction(unittest2.TestCase):
mock_gu.grub1_cfg.assert_called_once_with( mock_gu.grub1_cfg.assert_called_once_with(
kernel_params='fake_kernel_params root=UUID=fake_root_uuid ', kernel_params='fake_kernel_params root=UUID=fake_root_uuid ',
initrd='guessed_initrd', kernel='guessed_kernel', initrd='guessed_initrd', kernel='guessed_kernel',
chroot='/tmp/target', grub_timeout=5) chroot='/tmp/target', grub_timeout=10)
mock_gu.grub1_install.assert_called_once_with( mock_gu.grub1_install.assert_called_once_with(
['/dev/sda', '/dev/sdb', '/dev/sdc'], ['/dev/sda', '/dev/sdb', '/dev/sdc'],
'/dev/sda3', chroot='/tmp/target') '/dev/sda3', chroot='/tmp/target')
@ -94,7 +94,7 @@ class TestBootLoaderAction(unittest2.TestCase):
mock_gu.grub1_cfg.assert_called_once_with( mock_gu.grub1_cfg.assert_called_once_with(
kernel_params='fake_kernel_params root=UUID= ', kernel_params='fake_kernel_params root=UUID= ',
initrd='initrd_name', kernel='kernel_name', chroot='/tmp/target', initrd='initrd_name', kernel='kernel_name', chroot='/tmp/target',
grub_timeout=5) grub_timeout=10)
mock_gu.grub1_install.assert_called_once_with( mock_gu.grub1_install.assert_called_once_with(
['/dev/sda', '/dev/sdb', '/dev/sdc'], ['/dev/sda', '/dev/sdb', '/dev/sdc'],
'/dev/sda3', chroot='/tmp/target') '/dev/sda3', chroot='/tmp/target')
@ -167,7 +167,7 @@ class TestBootLoaderAction(unittest2.TestCase):
initrd='guessed_initrd', initrd='guessed_initrd',
chroot='/tmp/target', chroot='/tmp/target',
kernel='guessed_kernel', kernel='guessed_kernel',
grub_timeout=5) grub_timeout=10)
mock_gu.grub1_install.assert_called_once_with( mock_gu.grub1_install.assert_called_once_with(
['/dev/sda', '/dev/sdb', '/dev/sdc'], ['/dev/sda', '/dev/sdb', '/dev/sdc'],
'/dev/sda3', chroot='/tmp/target') '/dev/sda3', chroot='/tmp/target')
@ -188,7 +188,7 @@ class TestBootLoaderAction(unittest2.TestCase):
mock_gu.grub2_cfg.assert_called_once_with( mock_gu.grub2_cfg.assert_called_once_with(
kernel_params=' console=ttyS0,9600 console=tty0 rootdelay=90 ' kernel_params=' console=ttyS0,9600 console=tty0 rootdelay=90 '
'nomodeset root=UUID=fake_UUID ', 'nomodeset root=UUID=fake_UUID ',
chroot='/tmp/target', grub_timeout=5) chroot='/tmp/target', grub_timeout=10)
mock_gu.grub2_install.assert_called_once_with( mock_gu.grub2_install.assert_called_once_with(
['/dev/sda', '/dev/sdb', '/dev/sdc'], ['/dev/sda', '/dev/sdb', '/dev/sdc'],
chroot='/tmp/target') chroot='/tmp/target')

View File

@ -404,7 +404,7 @@ class TestGrubUtils(unittest2.TestCase):
mock_initrd.return_value = 'initrd-version' mock_initrd.return_value = 'initrd-version'
config = """ config = """
default=0 default=0
timeout=5 timeout=10
title Default (kernel-version) title Default (kernel-version)
kernel /kernel-version kernel-params kernel /kernel-version kernel-params
initrd /initrd-version initrd /initrd-version

View File

@ -199,7 +199,7 @@ def grub1_stage1(chroot=''):
def grub1_cfg(kernel=None, initrd=None, def grub1_cfg(kernel=None, initrd=None,
kernel_params='', chroot='', grub_timeout=5): kernel_params='', chroot='', grub_timeout=10):
if not kernel: if not kernel:
kernel = guess_kernel(chroot=chroot) kernel = guess_kernel(chroot=chroot)
@ -233,7 +233,7 @@ def grub2_install(install_devices, chroot='', boot_root='', lvm_boot=False):
utils.execute(*cmd, run_as_root=True, check_exit_code=[0]) utils.execute(*cmd, run_as_root=True, check_exit_code=[0])
def grub2_cfg(kernel_params='', chroot='', grub_timeout=5, lvm_boot=False): def grub2_cfg(kernel_params='', chroot='', grub_timeout=10, lvm_boot=False):
with grub2_prepare(kernel_params, chroot, grub_timeout, lvm_boot): with grub2_prepare(kernel_params, chroot, grub_timeout, lvm_boot):
cmd = [guess_grub2_mkconfig(chroot), '-o', guess_grub2_conf(chroot)] cmd = [guess_grub2_mkconfig(chroot), '-o', guess_grub2_conf(chroot)]
if chroot: if chroot:
@ -241,7 +241,7 @@ def grub2_cfg(kernel_params='', chroot='', grub_timeout=5, lvm_boot=False):
utils.execute(*cmd, run_as_root=True) utils.execute(*cmd, run_as_root=True)
def grub2_cfg_bundled(kernel_params='', chroot='', grub_timeout=5, def grub2_cfg_bundled(kernel_params='', chroot='', grub_timeout=10,
lvm_boot=False): lvm_boot=False):
# NOTE(oberezovskyi): symlink is required because of grub2-probe fails # NOTE(oberezovskyi): symlink is required because of grub2-probe fails
# to find device with root partition of fuel agent. # to find device with root partition of fuel agent.
@ -259,7 +259,8 @@ def grub2_cfg_bundled(kernel_params='', chroot='', grub_timeout=5,
@contextmanager @contextmanager
def grub2_prepare(kernel_params='', chroot='', grub_timeout=5, lvm_boot=False): def grub2_prepare(kernel_params='', chroot='', grub_timeout=10,
lvm_boot=False):
old_env = os.environ.copy() old_env = os.environ.copy()
os.environ['GRUB_DISABLE_SUBMENU'] = 'y' os.environ['GRUB_DISABLE_SUBMENU'] = 'y'
os.environ['GRUB_CMDLINE_LINUX_DEFAULT'] = kernel_params os.environ['GRUB_CMDLINE_LINUX_DEFAULT'] = kernel_params

View File

@ -41,7 +41,7 @@
#image_build_suffix=.bareon-image #image_build_suffix=.bareon-image
# Timeout in secs for GRUB (integer value) # Timeout in secs for GRUB (integer value)
#grub_timeout=5 #grub_timeout=10
# Maximum allowed loop devices count to use (integer value) # Maximum allowed loop devices count to use (integer value)
#max_loop_devices_count=255 #max_loop_devices_count=255