From 3356b440bae60aa717d0ee0928813123520c45b3 Mon Sep 17 00:00:00 2001 From: Thomas Bellman <bellman@lysator.liu.se> Date: Wed, 24 Jun 2020 15:25:58 +0200 Subject: [PATCH] Handle kernel options for Grub 2 when using Xen. When you are using the Xen virtualization hypervisor, you need to set a different variable, GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT, in /etc/default/grub to pass kernel options to the Dom0 Linux kernel, instead of GRUB_CMDLINE_LINUX when not using Xen. Detect when Xen Dom0 is used in bootloader::grub2::kernel_option and do the right thing. --- manifests/grub2/kernel_option.pp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/manifests/grub2/kernel_option.pp b/manifests/grub2/kernel_option.pp index 3b775d5..92f41f4 100644 --- a/manifests/grub2/kernel_option.pp +++ b/manifests/grub2/kernel_option.pp @@ -10,9 +10,13 @@ define bootloader::grub2::kernel_option($ensure, $value) include bootloader::grub2::rebuild_grub_cfg $grub_defaults_file = '/etc/default/grub' + $cfgparam = $::virtual ? { + 'xen0' => 'GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT', + default => 'GRUB_CMDLINE_LINUX', + } $qname = regexp_quote($name) # Augeas path expression to find nodes for the kernel parameter - $pathexpr = "GRUB_CMDLINE_LINUX/value[. =~ regexp('${qname}(=.*)?')]" + $pathexpr = "${cfgparam}/value[. =~ regexp('${qname}(=.*)?')]" if ($ensure == 'absent') { -- GitLab