1 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
2 : Copyright (c) 2017 Enea AB and others.
4 : All rights reserved. This program and the accompanying materials
5 : are made available under the terms of the Apache License, Version 2.0
6 : which accompanies this distribution, and is available at
7 : http://www.apache.org/licenses/LICENSE-2.0
8 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
9 From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
10 Date: Thu, 24 Aug 2017 04:09:59 +0200
11 Subject: [PATCH] lib.sh: rm Ubuntu boot entry on EFI systems
13 On EFI-enabled systems, grub-install from grub-efi-* package
14 installs a boot entry named "ubuntu".
16 MaaS relies on IPMI to set boot order to PXE first; however
17 on systems with buggy firmware or without full IPMI support,
18 that fails, leading to booting Ubuntu from hard disk instead.
20 Work around this by clearing any previous Ubuntu boot entry
21 from board flash, before starting a new baremetal deploy.
23 NOTE: This only runs against nodes that are online from a
28 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
30 mcp/scripts/lib.sh | 10 ++++++++++
31 1 file changed, 10 insertions(+)
33 diff --git a/mcp/scripts/lib.sh b/mcp/scripts/lib.sh
34 index 7449a21..4657195 100644
35 --- a/mcp/scripts/lib.sh
36 +++ b/mcp/scripts/lib.sh
37 @@ -35,6 +35,15 @@ function get_base_image {
38 wget -P "${image_dir}" -N "${base_image}"
41 +function cleanup_uefi {
42 + # Clean up Ubuntu boot entry if cfg01, kvm nodes online from previous deploy
43 + # shellcheck disable=SC2086
44 + ssh ${SSH_OPTS} "ubuntu@${SALT_MASTER}" "sudo salt -C 'kvm* or cmp*' cmd.run \
45 + \"which efibootmgr > /dev/null 2>&1 && \
46 + efibootmgr | grep -oP '(?<=Boot)[0-9]+(?=.*ubuntu)' | \
47 + xargs -I{} efibootmgr --delete-bootnum --bootnum {}\"" || true
50 function cleanup_vms {
51 # clean up existing nodes
52 for node in $(virsh list --name | grep -P '\w{3}\d{2}'); do
53 @@ -52,6 +61,7 @@ function prepare_vms {
59 get_base_image "${base_image}" "${image_dir}"
60 # shellcheck disable=SC2016