Skip to content
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

teach propolis-server to understand configurable boot order #756

Merged
merged 45 commits into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
f5437f6
wip: teach propolis-server to understand configurable boot order
iximeow Sep 4, 2024
2032c1b
Merge branch 'master' into ixi/propolis-bootorder
iximeow Sep 5, 2024
ca97278
log plumbing
iximeow Sep 6, 2024
d5e43c4
shelve the first_boot_only attribute for a moment
iximeow Sep 7, 2024
3f921f0
rustfmt and log tweaks
iximeow Sep 10, 2024
e0c7c71
include actually-usable tests
iximeow Sep 10, 2024
54bda84
actually include guest OS definitions for 24.04 (shouldn't land)
iximeow Sep 10, 2024
cc485b0
move all the EFI variable stuff to a module
iximeow Sep 12, 2024
7ddf735
lose dependency on specific test images
iximeow Sep 12, 2024
b112aa6
fill out other half of test "boot_order_source_priority"
iximeow Sep 13, 2024
f0a09db
use the implicit boot-disk entry like every other test
iximeow Sep 13, 2024
ed4a3e8
use empty FAT filesystems for unbootable disks
iximeow Sep 13, 2024
7484eb4
log formatting consistency
iximeow Sep 13, 2024
ed455ea
review feedback: stray eprintln, include new boot_order in api-types
iximeow Sep 17, 2024
ee46c91
Merge remote-tracking branch 'github/master' into ixi/propolis-bootorder
iximeow Sep 17, 2024
09583fb
extracted that into another PR
iximeow Sep 17, 2024
7d595a3
cleanup on aisle SpecBuilder
iximeow Sep 17, 2024
f53ba2e
fix phd-tests also
iximeow Sep 17, 2024
16138d1
clippy lints
iximeow Sep 17, 2024
92e9859
include new boot order item in propolis-server-falcon.json too
iximeow Sep 17, 2024
2183773
fix formatting in propolis-server.json
iximeow Sep 17, 2024
05495d5
fix bad merge resolution
iximeow Sep 18, 2024
6a386b0
move to more forward-compatible boot settings approach
iximeow Sep 24, 2024
bcb6824
check if guest environment supports efivar writes, bail early if not
iximeow Sep 24, 2024
3200708
update falcon openapi document too
iximeow Sep 24, 2024
d4d9b07
last eprintln: should be trace tbh
iximeow Sep 24, 2024
fda55f8
Merge remote-tracking branch 'github/master' into ixi/propolis-bootorder
iximeow Sep 24, 2024
3ad7383
keep some notes about where backend_name went from
iximeow Sep 24, 2024
2e01169
resolve merge conflict with refactors
iximeow Sep 25, 2024
9af0380
one less todo
iximeow Sep 25, 2024
617dd0c
settle on an actual approach for the test "boot_disk" helper fn
iximeow Sep 25, 2024
fcfa0a2
ok, keep all tests passing with framework changes
iximeow Sep 25, 2024
247f1e3
rustfmt
iximeow Sep 25, 2024
52aa0fe
speed limit 80
iximeow Sep 25, 2024
c9a522b
dont want to wrap those lines, avoid the problem
iximeow Sep 25, 2024
bbeafcf
rustfmt
iximeow Sep 25, 2024
a636216
rustfmt
iximeow Sep 25, 2024
ab9743e
remove unneeded (and not-generally-correct) ubuntu 24.04 adapter
iximeow Sep 25, 2024
458b740
cargo clippy --workspace...
iximeow Sep 25, 2024
6d0077e
remove unnecessary warning about EFI partition
iximeow Sep 25, 2024
cee2adc
fix migration tests for this non-API-breaking change
iximeow Sep 25, 2024
93e33e4
Update phd-tests/framework/src/test_vm/config.rs
iximeow Sep 25, 2024
ba45929
make PHD disk name/backend name derivation match propolis-server API
iximeow Sep 27, 2024
22b5a08
review feedback:
iximeow Sep 27, 2024
3a3e753
use newtypes to delineate DeviceName/BackendName in PHD
iximeow Sep 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 2 additions & 16 deletions bin/propolis-server/src/lib/initializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1036,22 +1036,8 @@ impl<'a> MachineInitializer<'a> {
for boot_entry in boot_names.iter() {
iximeow marked this conversation as resolved.
Show resolved Hide resolved
// Theoretically we could support booting from network devices by
// matching them here and adding their PCI paths, but exactly what
// would happen is ill-understood and device names are not plumbed
// in a way that supports it. So, only check disks here.
if let Some(spec) = self
.spec
.disks
.iter()
.find(|(_name, spec)| match &spec.device_spec {
StorageDevice::Nvme(disk) => {
disk.backend_name.as_str() == boot_entry.name.as_str()
}
StorageDevice::Virtio(disk) => {
disk.backend_name.as_str() == boot_entry.name.as_str()
}
})
.map(|(_name, spec)| spec)
{
// would happen is ill-understood. So, only check disks here.
if let Some(spec) = self.spec.disks.get(boot_entry.name.as_str()) {
match &spec.device_spec {
StorageDevice::Virtio(disk) => {
let bdf = parse_bdf(&disk.pci_path)?;
Expand Down
19 changes: 3 additions & 16 deletions bin/propolis-server/src/lib/spec/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,25 +118,12 @@ impl SpecBuilder {
&mut self,
item: &BootOrderEntry,
) -> Result<(), SpecBuilderError> {
let boot_order = self.spec.boot_order.get_or_insert(Vec::new());

use crate::spec::StorageDevice;
use crate::spec::{NvmeDisk, VirtioDisk};

let is_disk =
self.spec.disks.values().any(|disk| match &disk.device_spec {
StorageDevice::Virtio(VirtioDisk { backend_name, .. }) => {
backend_name == item.name.as_str()
}
StorageDevice::Nvme(NvmeDisk { backend_name, .. }) => {
backend_name == item.name.as_str()
}
});

if !is_disk {
if !self.spec.disks.contains_key(item.name.as_str()) {
return Err(SpecBuilderError::BootOptionMissing(item.name.clone()));
}

let boot_order = self.spec.boot_order.get_or_insert(Vec::new());

boot_order
.push(crate::spec::BootOrderEntry { name: item.name.clone() });

Expand Down
10 changes: 7 additions & 3 deletions phd-tests/framework/src/test_vm/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,14 @@ impl<'dr> VmConfig<'dr> {
// in the correct order: boot disk first, then in the data disks'
// iteration order.
let all_disks = self.disks.iter().zip(disk_handles.iter());
for (idx, (req, hdl)) in all_disks.enumerate() {
let device_name = format!("disk-device{}", idx);
for (req, hdl) in all_disks {
let pci_path = PciPath::new(0, req.pci_device_num, 0).unwrap();
let (backend_name, backend_spec) = hdl.backend_spec();
let (device_name, backend_spec) = hdl.backend_spec();
// propolis-server uses a disk's name from the API as its device
// name. It then derives a backend name from the disk name. Match
// that name derivation here so PHD tests match the API as used by
// Nexus.
let backend_name = format!("{}-backend", device_name);
iximeow marked this conversation as resolved.
Show resolved Hide resolved
let device_spec = match req.interface {
DiskInterface::Virtio => {
StorageDeviceV0::VirtioDisk(VirtioDisk {
Expand Down
Loading