Skip to content

Commit b6ab921

Browse files
committed
Panic with a clear message if the viona API is too old
Currently if one runs propolis on a system which does not have a new enough viona API, a stacktrace like this is generated. failed to enable promisc mode on vnic0: Os { code: 22, kind: InvalidInput, message: "Invalid argument" } called `Result::unwrap()` on an `Err` value: Os { code: 25, kind: Uncategorized, message: "Inappropriate ioctl for device" } stack backtrace: 0: __rustc::rust_begin_unwind 1: core::panicking::panic_fmt 2: core::result::unwrap_failed 3: propolis::hw::virtio::viona::PciVirtioViona::new_with_queue_sizes 4: propolis::hw::virtio::viona::PciVirtioViona::new Since we don't currently support anything older than the V6 API in propolis we should at least produce a useful error message to the operator. It would be possible to fall back to the older API if we wish to implement that.
1 parent 909f5e3 commit b6ab921

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

bin/propolis-server/src/lib/initializer.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,13 @@ impl MachineInitializer<'_> {
771771
info!(self.log, "Creating vNIC {}", device_name);
772772
let bdf: pci::Bdf = nic.device_spec.pci_path.into();
773773

774+
if virtio::viona::api_version()
775+
.expect("can query viona version")
776+
< virtio::viona::ApiVersion::V6
777+
{
778+
panic!("Kernel viona API is too old; need >= V6");
779+
}
780+
774781
// Set viona device parameters if possible.
775782
//
776783
// The values chosen here are tuned to maximize performance when

bin/propolis-standalone/src/main.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,6 +1247,13 @@ fn setup_instance(
12471247
dev.options.get("vnic").unwrap().as_str().unwrap();
12481248
let bdf = bdf.unwrap();
12491249

1250+
if hw::virtio::viona::api_version()
1251+
.expect("can query viona version")
1252+
< hw::virtio::viona::ApiVersion::V6
1253+
{
1254+
panic!("Kernel viona API is too old; need >= V6");
1255+
}
1256+
12501257
let viona_params =
12511258
config::VionaDeviceParams::from_opts(&dev.options)
12521259
.expect("viona params are valid");

0 commit comments

Comments
 (0)