Skip to content

Commit

Permalink
Fix non illumos support
Browse files Browse the repository at this point in the history
  • Loading branch information
papertigers committed Feb 28, 2024
1 parent 1b56562 commit 1d9cfee
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
17 changes: 0 additions & 17 deletions sled-hardware/src/illumos/partitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ fn preferred_nvme_device_settings(
}

#[derive(Debug, thiserror::Error)]
#[cfg(target_os = "illumos")]
pub enum NvmeFormattingError {
#[error(transparent)]
NvmeInit(#[from] libnvme::NvmeInitError),
Expand All @@ -72,13 +71,6 @@ pub enum NvmeFormattingError {
NoController(String),
}

#[derive(Debug, thiserror::Error)]
#[cfg(not(target_os = "illumos"))]
pub enum NvmeFormattingError {
#[error("NVMe formatting is unsupported on this platform")]
UnsupportedPlatform,
}

// The expected layout of an M.2 device within the Oxide rack.
//
// Partitions beyond this "expected partition" array are ignored.
Expand Down Expand Up @@ -225,7 +217,6 @@ fn internal_ensure_partition_layout<GPT: gpt::LibEfiGpt>(
}
}

#[cfg(target_os = "illumos")]
fn ensure_size_and_formatting(
log: &Logger,
identity: &DiskIdentity,
Expand Down Expand Up @@ -328,14 +319,6 @@ fn ensure_size_and_formatting(
Ok(())
}

#[cfg(not(target_os = "illumos"))]
fn ensure_size_and_formatting(
log: &Logger,
identity: &DiskIdentity,
) -> Result<(), NvmeFormattingError> {
Ok(())
}

#[cfg(test)]
mod test {
use super::*;
Expand Down
8 changes: 8 additions & 0 deletions sled-hardware/src/non_illumos/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,17 @@ use crate::disk::{
DiskPaths, DiskVariant, Partition, PooledDiskError, UnparsedDisk,
};
use crate::{Baseboard, SledMode};
use omicron_common::disk::DiskIdentity;
use slog::Logger;
use std::collections::HashSet;
use tokio::sync::broadcast;

#[derive(Debug, thiserror::Error)]
pub enum NvmeFormattingError {
#[error("NVMe formatting is unsupported on this platform")]
UnsupportedPlatform,
}

/// An unimplemented, stub representation of the underlying hardware.
///
/// This is intended for non-illumos systems to have roughly the same interface
Expand Down Expand Up @@ -59,6 +66,7 @@ pub fn ensure_partition_layout(
_log: &Logger,
_paths: &DiskPaths,
_variant: DiskVariant,
_identity: &DiskIdentity,
) -> Result<Vec<Partition>, PooledDiskError> {
unimplemented!("Accessing hardware unsupported on non-illumos");
}
Expand Down

0 comments on commit 1d9cfee

Please sign in to comment.