p/fuel: Update armband state for baremetal support
[armband.git] / patches / opnfv-fuel / 0019-states-maas-rm-Ubuntu-boot-entry-on-EFI-systems.patch
1 From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
2 Date: Thu, 24 Aug 2017 04:09:59 +0200
3 Subject: [PATCH] states/maas: rm Ubuntu boot entry on EFI systems
4
5 On EFI-enabled systems, grub-install from grub-efi-* package
6 installs a boot entry named "ubuntu".
7
8 MaaS relies on IPMI to set boot order to PXE first; however
9 on systems with buggy firmware or without full IPMI support,
10 that fails, leading to booting Ubuntu from hard disk instead.
11
12 Work around this by clearing any previous Ubuntu boot entry
13 from board flash.
14
15 NOTE: This only runs against nodes that are online from a
16 previous deploy, and already automatically registered with
17 the new Salt master node.
18
19 Closes: ARMBAND-47
20
21 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
22 ---
23  mcp/config/states/maas | 5 +++++
24  1 file changed, 5 insertions(+)
25
26 diff --git a/mcp/config/states/maas b/mcp/config/states/maas
27 index 697f83c..383063d 100755
28 --- a/mcp/config/states/maas
29 +++ b/mcp/config/states/maas
30 @@ -44,6 +44,11 @@ function maas_fixup() {
31    return 0
32  }
33
34 +# UEFI: Clean up Ubuntu boot entry if kvm node online from previous deploy
35 +salt -C 'kvm* or cmp*' cmd.run "(which efibootmgr > /dev/null 2>&1 && \
36 +  efibootmgr | grep -oP '(?<=Boot)[0-9]+(?=.*ubuntu)' | \
37 +  xargs -I{} efibootmgr --delete-bootnum --bootnum {}) || true"
38 +
39  # MaaS rack/region controller, node commissioning
40  salt -C 'mas01*' cmd.run "add-apt-repository ppa:maas/stable"
41