Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions bin/propolis-server/src/lib/initializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,12 @@ impl MachineInitializer<'_> {
info!(self.log, "Creating vNIC {}", device_name);
let bdf: pci::Bdf = nic.device_spec.pci_path.into();

if virtio::viona::api_version().expect("can query viona version")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it may be a bit more idiomatic to use assert!() here. Something like:

Suggested change
if virtio::viona::api_version().expect("can query viona version")
let viona_version = virtio::viona::api_version().expect("got viona version");
assert!(viona_version >= virtio::viona::ApiVersion::V6,
"viona version {viona_version:?} is too old; need >= V6. Upgrade host OS");

< virtio::viona::ApiVersion::V6
{
panic!("Kernel viona API is too old; need >= V6");
}

// Set viona device parameters if possible.
//
// The values chosen here are tuned to maximize performance when
Expand Down
7 changes: 7 additions & 0 deletions bin/propolis-standalone/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1247,6 +1247,13 @@ fn setup_instance(
dev.options.get("vnic").unwrap().as_str().unwrap();
let bdf = bdf.unwrap();

if hw::virtio::viona::api_version()
.expect("can query viona version")
< hw::virtio::viona::ApiVersion::V6
{
panic!("Kernel viona API is too old; need >= V6");
}

let viona_params =
config::VionaDeviceParams::from_opts(&dev.options)
.expect("viona params are valid");
Expand Down
Loading