Skip to content

Commit

Permalink
Fail obviously if the kernel does not support the xde driver (#1070)
Browse files Browse the repository at this point in the history
  • Loading branch information
bnaecker authored May 16, 2022
1 parent a179f03 commit a1a5916
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions sled-agent/src/opte/opte.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ pub enum Error {
)]
NoXdeConf,

#[error(
"The OS kernel does not support the xde driver. Please update the OS \
using `./tools/install_opte.sh` to provide kernel bits and the xde \
driver which are compatible."
)]
IncompatibleKernel,

#[error(transparent)]
BadAddrObj(#[from] addrobj::ParseError),
}
Expand Down Expand Up @@ -319,6 +326,19 @@ pub fn initialize_xde_driver(log: &Logger) -> Result<(), Error> {
.set_xde_underlay(&underlay_nics[0].0, &underlay_nics[1].0)
{
Ok(_) => Ok(()),
// Handle the specific case where the kernel appears to be unaware of
// xde at all. This implies the developer has not installed the correct
// helios-netdev kernel bits.
//
// TODO-correctness: This error should never occur in the product. Both
// xde the kernel driver and the kernel bits needed to recognize it will
// be packaged as part of our OS ramdisk, meaning it should not be
// possible to get out of sync.
Err(opte_ioctl::Error::IoctlFailed(_, ref message))
if message.contains("unexpected errno: 48") =>
{
Err(Error::IncompatibleKernel)
}
// TODO-correctness: xde provides no way to get the current underlay
// devices we're using, but we'd probably like the further check that
// those are exactly what we're giving it now.
Expand Down

0 comments on commit a1a5916

Please sign in to comment.