Skip to content

Commit

Permalink
OpenShift: Improve EFI code in sno-finish.sh (#789)
Browse files Browse the repository at this point in the history
* OpenShift: EFI clean old RHCOS entries

If we use the same host to redeploy an OpenShift cluster we'll end up
with a long list of RHCOS entries in EFI.

With this patch we clean not only the DVD and CD entry but also any
RHCOS entry previously created.

This way only the newly RHCOS created entry will be left.

* OpenShift: EFI don't pass unnecessary $NUM

When cleaning EFI entries we are using:

```
efibootmgr -b 000$NUM -B $NUM
```

But according to the documentation the last $NUM is not necessary:

```
       -b | --bootnum XXXX
              Modify BootXXXX (hex).

       -B | --delete-bootnum
              Delete bootnum.
```

So we just remove it.

* OpenShift: EFI support more than 10 entries

Current code in `sno-finish.sh` assumes there can never be more than 10
entries, which is not correct.

If we've done a lot of retries deploying OpenShift on the same node we
may have more than 10 EFI entries.

With this patch we change the regex used to get the boot number as an
hexadecimal 4 digits entry.
  • Loading branch information
Akrog authored Feb 27, 2025
1 parent 21d0d80 commit 383584f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions kvirt/cluster/openshift/sno-finish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ echo "Executing coreos-installer with ignition file /opt/openshift/master.ign an
coreos-installer install --firstboot-args="${firstboot_args}" --ignition=/opt/openshift/master.ign $install_device

if [ -d /sys/firmware/efi ] ; then
NUM=$(efibootmgr -v | grep 'DVD\|CD' | cut -f1 -d' ' | sed 's/Boot000\([0-9]\)\*/\1/')
efibootmgr -b 000$NUM -B $NUM
for NUM in $(efibootmgr -v | grep 'DVD\|CD\|RHCOS' | cut -f1 -d' ' | sed 's/Boot\([0-9,A-F,a-f]\{4\}\)\*/\1/'); do
efibootmgr -b $NUM -B
done

mount /${install_device}2 /mnt
efibootmgr -d ${install_device} -p 2 -c -L RHCOS -l \\EFI\\BOOT\\BOOTX64.EFI
fi
Expand Down

0 comments on commit 383584f

Please sign in to comment.