-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathmod.rs
86 lines (72 loc) · 2.81 KB
/
mod.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
use crate::SledMode;
use crate::disk::{DiskPaths, Partition, PooledDiskError, UnparsedDisk};
use omicron_common::disk::{DiskIdentity, DiskVariant};
use omicron_uuid_kinds::ZpoolUuid;
use sled_hardware_types::Baseboard;
use slog::Logger;
use std::collections::HashMap;
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
/// as illumos systems - it allows compilation to "work" on non-illumos
/// platforms, which can be handy for editor support.
///
/// If you're actually trying to run the Sled Agent on non-illumos platforms,
/// use the simulated sled agent, which does not attempt to abstract hardware.
#[derive(Clone)]
pub struct HardwareManager {}
impl HardwareManager {
pub fn new(
_log: &Logger,
_sled_mode: SledMode,
_nongimlet_observed_disks: Vec<UnparsedDisk>,
) -> Result<Self, String> {
unimplemented!("Accessing hardware unsupported on non-illumos");
}
pub fn baseboard(&self) -> Baseboard {
unimplemented!("Accessing hardware unsupported on non-illumos");
}
pub fn online_processor_count(&self) -> u32 {
unimplemented!("Accessing hardware unsupported on non-illumos");
}
pub fn usable_physical_pages(&self) -> u64 {
unimplemented!("Accessing hardware unsupported on non-illumos");
}
pub fn usable_physical_ram_bytes(&self) -> u64 {
unimplemented!("Accessing hardware unsupported on non-illumos");
}
pub fn disks(&self) -> HashMap<DiskIdentity, UnparsedDisk> {
unimplemented!("Accessing hardware unsupported on non-illumos");
}
pub fn is_scrimlet(&self) -> bool {
unimplemented!("Accessing hardware unsupported on non-illumos");
}
pub fn is_scrimlet_driver_loaded(&self) -> bool {
unimplemented!("Accessing hardware unsupported on non-illumos");
}
pub fn monitor(&self) -> broadcast::Receiver<super::HardwareUpdate> {
unimplemented!("Accessing hardware unsupported on non-illumos");
}
}
pub fn ensure_partition_layout(
_log: &Logger,
_paths: &DiskPaths,
_variant: DiskVariant,
_identity: &DiskIdentity,
_zpool_id: Option<ZpoolUuid>,
) -> Result<Vec<Partition>, PooledDiskError> {
unimplemented!("Accessing hardware unsupported on non-illumos");
}
/// Return true if the host system is an Oxide Gimlet.
pub fn is_gimlet() -> anyhow::Result<bool> {
Ok(false)
}