-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
efi: support updating multiple EFIs in mirrored setups (RAID1) #855
Open
HuijingHei
wants to merge
1
commit into
coreos:main
Choose a base branch
from
HuijingHei:efi-raid1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+159
−61
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
variant: fcos | ||
version: 1.5.0 | ||
boot_device: | ||
mirror: | ||
devices: | ||
- /dev/vda | ||
- /dev/vdb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../data/libtest.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
## kola: | ||
## # additionalDisks is only supported on qemu. | ||
## platforms: qemu | ||
## # Root reprovisioning requires at least 4GiB of memory. | ||
## minMemory: 4096 | ||
## # Linear RAID is setup on these disks. | ||
## additionalDisks: ["10G"] | ||
## # This test includes a lot of disk I/O and needs a higher | ||
## # timeout value than the default. | ||
## timeoutMin: 15 | ||
## description: Verify updating multiple EFIs with RAID 1 works. | ||
|
||
set -xeuo pipefail | ||
|
||
# shellcheck disable=SC1091 | ||
. "$KOLA_EXT_DATA/libtest.sh" | ||
|
||
srcdev=$(findmnt -nvr /sysroot -o SOURCE) | ||
[[ ${srcdev} == "/dev/md126" ]] | ||
|
||
blktype=$(lsblk -o TYPE "${srcdev}" --noheadings) | ||
[[ ${blktype} == "raid1" ]] | ||
|
||
fstype=$(findmnt -nvr /sysroot -o FSTYPE) | ||
[[ ${fstype} == "xfs" ]] | ||
ok "source is XFS on RAID1 device" | ||
|
||
|
||
mount -o remount,rw /boot | ||
|
||
rm -f -v /boot/bootupd-state.json | ||
|
||
bootupctl adopt-and-update | grep "Adopted and updated: EFI" | ||
|
||
bootupctl status | grep "Component EFI" | ||
ok "bootupctl adopt-and-update supports multiple EFIs on RAID1" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you considered / tried the case with 2 disks / 2 separate OS ? (we do that in our lab, 2 or even 3 rpm-ostree based OS, each one on one disk, all installed via anaconda)
I'm asking because quickly looking at the code, I would use
find_colocated_esps("/")
first andget_esp_device()
as a fallback.The safest might even be:
If you have a bootc installed OS, and on a second disk an anaconda installed OS (not even ostree based), right now you are going to always pick the anaconda ESP
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_esp_device()
will find CoreOS ESP label/dev/disk/by-partlabel/EFI-SYSTEM
, or Anaconda ESP label/dev/disk/by-partlabel/EFI\\x20System\\x20Partition
find_colocated_esps("/")
will list ESP partitions on the devices with mountpoint/boot
, but it does not mean it is always mounted, for example, coreos does not mount esp after booted, see docConsider that on single disk, can easily get ESP label
/dev/disk/by-partlabel/EFI-SYSTEM
viaget_esp_device()
, but on multiple disks, it would be/dev/disk/by-label/esp-1
&/dev/disk/by-label/esp-2
, does this make sense?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I did: when running update,
get_esp_devices()
would list the all esp devices, then in the loop device will check mounted ESP first, if not, will mount the esp then upgrade. I think you meant that need to check mounted firstly in the beginning, will try that, thanks!Edit: For multiple disks, we still need the loop for each esp device. Will keep it as it is, WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I don't understand rust code, but for me it first call
get_esp_device()
which returns 1 device based on a weak heuristic, if that fails then it tries to find multiple devicesHere 3 test cases, second OS (sdb) booted, running
get_esp_devices()
:sda: normal anaconda install
sdb: ESP not mounted, not using anaconda/coreos label
-> returns sda ?
sda: normal anaconda install
sdb & sdc: raid 1 mirrored, ESP not mounted, not using anaconda/coreos label
-> returns sda ?
sda: normal coreos install
sdb: also a coreos install, ESP not mounted
-> not sure which PARTLABEL wins, likely random at each boot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not have such env, but IMU, if second OS (sdb) booted, sda will not be mounted from the booted OS, in this case, we do not scan sda.
skip sda, and
get_esp_devices()
will callfind_colocated_esps("/")
to find the mount point /boot device, then get ESP part on the same deviceskip sda, this is the case that we need to resolve actually,
find_colocated_esps("/")
to find the mount point/boot
device which is/dev/md126
, then need to get the backing devices listsdb & sdc
and find ESP part on each deviceWhen I tried to boot VM with 2 coreos, failed with:
So we can skip this env.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @travier to confirm about my reply, not sure if my understanding is correct, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a server with 3 disks / 3 installs side by side
All 3 wants to have the
by-partlabel
symlink, only the first one gets it, I'm not aware of any ordering/prioritiesIn case 1&2 we do not mount sda, but udev definitely scans it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If booted sda, then it will find ESP part in sda, I do not think it will retrieve all the devices.