Skip to content
Merged
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
8 changes: 4 additions & 4 deletions installinator/src/hardware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ pub struct Hardware {

impl Hardware {
pub async fn scan(log: &Logger) -> Result<Self> {
let is_gimlet = sled_hardware::is_gimlet()
.context("failed to detect whether host is a gimlet")?;
ensure!(is_gimlet, "hardware scan only supported on gimlets");
let is_oxide_sled = sled_hardware::is_oxide_sled()
.context("failed to detect whether host is an oxide sled")?;
ensure!(is_oxide_sled, "hardware scan only supported on oxide sleds");

let hardware = HardwareManager::new(log, SledMode::Auto, vec![])
.map_err(|err| {
Expand All @@ -34,7 +34,7 @@ impl Hardware {
hardware.disks().into_values().map(|disk| disk.into()).collect();

info!(
log, "found gimlet hardware";
log, "found oxide sled hardware";
"baseboard" => ?hardware.baseboard(),
"is_scrimlet" => hardware.is_scrimlet(),
"num_disks" => disks.len(),
Expand Down
2 changes: 1 addition & 1 deletion nexus/inventory/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ impl CollectionBuilder {

let baseboard_id = match inventory.baseboard {
Baseboard::Pc { .. } => None,
Baseboard::Gimlet { identifier, model, revision: _ } => {
Baseboard::Gimlet { identifier, model, .. } => {
Some(Self::normalize_item(
&mut self.baseboards,
BaseboardId {
Expand Down
17 changes: 9 additions & 8 deletions sled-agent/src/bin/sled-agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ use omicron_common::cmd::fatal;
use omicron_sled_agent::bootstrap::RssAccessError;
use omicron_sled_agent::bootstrap::server as bootstrap_server;
use omicron_sled_agent::config::Config as SledConfig;
use sled_agent_types::rack_init::RackInitializeRequest;
use sled_agent_types::rack_init::{
RackInitializeRequest, RackInitializeRequestParams,
};

#[derive(Debug, Parser)]
#[clap(
Expand Down Expand Up @@ -60,14 +62,13 @@ async fn do_run() -> Result<(), CmdError> {
rss_config_path.push("config-rss.toml");
rss_config_path
};
let rss_config = if rss_config_path.exists() {
Some(
let rss_config = rss_config_path.exists().then_some({
let rss_config =
RackInitializeRequest::from_file(rss_config_path)
.map_err(|e| CmdError::Failure(anyhow!(e)))?,
)
} else {
None
};
.map_err(|e| CmdError::Failure(anyhow!(e)))?;
let skip_timesync = config.skip_timesync.unwrap_or(false);
RackInitializeRequestParams::new(rss_config, skip_timesync)
});

let server = bootstrap_server::Server::start(config)
.await
Expand Down
13 changes: 10 additions & 3 deletions sled-agent/src/bootstrap/http_entrypoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ use omicron_common::api::external::Error;
use omicron_uuid_kinds::RackInitUuid;
use omicron_uuid_kinds::RackResetUuid;
use sled_agent_config_reconciler::InternalDisksReceiver;
use sled_agent_types::rack_init::RackInitializeRequest;
use sled_agent_types::rack_init::{
RackInitializeRequest, RackInitializeRequestParams,
};
use sled_agent_types::rack_ops::RackOperationStatus;
use sled_hardware_types::Baseboard;
use slog::Logger;
Expand All @@ -50,7 +52,7 @@ pub(crate) struct BootstrapServerContext {
impl BootstrapServerContext {
pub(super) fn start_rack_initialize(
&self,
request: RackInitializeRequest,
request: RackInitializeRequestParams,
) -> Result<RackInitUuid, RssAccessError> {
self.rss_access.start_initializing(
&self.base_log,
Expand Down Expand Up @@ -106,8 +108,13 @@ impl BootstrapAgentApi for BootstrapAgentImpl {
rqctx: RequestContext<Self::Context>,
body: TypedBody<RackInitializeRequest>,
) -> Result<HttpResponseOk<RackInitUuid>, HttpError> {
// Note that if we are performing rack initialization in
// response to an external request, we assume we are not
// skipping timesync.
const SKIP_TIMESYNC: bool = false;
let ctx = rqctx.context();
let request = body.into_inner();
let request =
RackInitializeRequestParams::new(body.into_inner(), SKIP_TIMESYNC);
let id = ctx
.start_rack_initialize(request)
.map_err(|err| HttpError::for_bad_request(None, err.to_string()))?;
Expand Down
2 changes: 1 addition & 1 deletion sled-agent/src/bootstrap/pre_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ fn sled_mode_from_config(config: &Config) -> Result<SledMode, StartError> {
}
SledMode::Auto
}
SledModeConfig::Gimlet => SledMode::Gimlet,
SledModeConfig::Sled => SledMode::Sled,
SledModeConfig::Scrimlet => {
let asic = if cfg!(feature = "switch-asic") {
DendriteAsic::TofinoAsic
Expand Down
6 changes: 3 additions & 3 deletions sled-agent/src/bootstrap/rack_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use bootstore::schemes::v0 as bootstore;
use omicron_uuid_kinds::RackInitUuid;
use omicron_uuid_kinds::RackResetUuid;
use sled_agent_config_reconciler::InternalDisksReceiver;
use sled_agent_types::rack_init::RackInitializeRequest;
use sled_agent_types::rack_init::RackInitializeRequestParams;
use sled_agent_types::rack_ops::{RackOperationStatus, RssStep};
use slog::Logger;
use sprockets_tls::keys::SprocketsConfig;
Expand Down Expand Up @@ -148,7 +148,7 @@ impl RssAccess {
global_zone_bootstrap_ip: Ipv6Addr,
internal_disks_rx: &InternalDisksReceiver,
bootstore_node_handle: &bootstore::NodeHandle,
request: RackInitializeRequest,
request: RackInitializeRequestParams,
) -> Result<RackInitUuid, RssAccessError> {
let mut status = self.status.lock().unwrap();

Expand Down Expand Up @@ -330,7 +330,7 @@ async fn rack_initialize(
global_zone_bootstrap_ip: Ipv6Addr,
internal_disks_rx: InternalDisksReceiver,
bootstore_node_handle: bootstore::NodeHandle,
request: RackInitializeRequest,
request: RackInitializeRequestParams,
step_tx: watch::Sender<RssStep>,
) -> Result<(), SetupServiceError> {
RssHandle::run_rss(
Expand Down
4 changes: 2 additions & 2 deletions sled-agent/src/bootstrap/rss_handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use omicron_common::backoff::BackoffError;
use omicron_common::backoff::retry_notify;
use omicron_common::backoff::retry_policy_local;
use sled_agent_config_reconciler::InternalDisksReceiver;
use sled_agent_types::rack_init::RackInitializeRequest;
use sled_agent_types::rack_init::RackInitializeRequestParams;
use sled_agent_types::rack_ops::RssStep;
use sled_agent_types::sled::StartSledAgentRequest;
use slog::Logger;
Expand Down Expand Up @@ -48,7 +48,7 @@ impl RssHandle {
pub(super) async fn run_rss(
log: &Logger,
sprockets: SprocketsConfig,
config: RackInitializeRequest,
config: RackInitializeRequestParams,
our_bootstrap_address: Ipv6Addr,
internal_disks_rx: InternalDisksReceiver,
bootstore: bootstore::NodeHandle,
Expand Down
8 changes: 4 additions & 4 deletions sled-agent/src/bootstrap/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ use omicron_uuid_kinds::GenericUuid;
use omicron_uuid_kinds::RackInitUuid;
use sled_agent_config_reconciler::ConfigReconcilerSpawnToken;
use sled_agent_config_reconciler::InternalDisksReceiver;
use sled_agent_types::rack_init::RackInitializeRequest;
use sled_agent_types::rack_init::RackInitializeRequestParams;
use sled_agent_types::sled::StartSledAgentRequest;
use sled_hardware::underlay;
use sled_storage::dataset::CONFIG_DATASET;
Expand Down Expand Up @@ -290,7 +290,7 @@ impl Server {

pub fn start_rack_initialize(
&self,
request: RackInitializeRequest,
request: RackInitializeRequestParams,
) -> Result<RackInitUuid, RssAccessError> {
self.bootstrap_http_server.app_private().start_rack_initialize(request)
}
Expand Down Expand Up @@ -594,8 +594,8 @@ impl Inner {
let initial = server.sled_agent().start_request();
let response = if initial != &request {
Err(format!(
"Sled Agent already running:
initital request = {:?},
"Sled Agent already running:
initital request = {:?},
current request: {:?}",
initial, request
))
Expand Down
9 changes: 5 additions & 4 deletions sled-agent/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ use illumos_utils::dladm::PhysicalLink;
use omicron_common::vlan::VlanID;
use serde::Deserialize;
use sled_hardware::UnparsedDisk;
use sled_hardware::is_gimlet;
use sled_hardware::is_oxide_sled;
use sprockets_tls::keys::SprocketsConfig;

#[derive(Clone, Debug, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum SledMode {
Auto,
Gimlet,
#[serde(alias = "gimlet")]
Sled,
Scrimlet,
}

Expand Down Expand Up @@ -137,7 +138,7 @@ pub enum ConfigError {
},
#[error("Loading certificate: {0}")]
Certificate(#[source] anyhow::Error),
#[error("Could not determine if host is a Gimlet: {0}")]
#[error("Could not determine if host is an Oxide sled: {0}")]
SystemDetection(#[source] anyhow::Error),
#[error("Could not enumerate physical links")]
FindLinks(#[from] FindPhysicalLinkError),
Expand All @@ -158,7 +159,7 @@ impl Config {
if let Some(link) = self.data_link.as_ref() {
Ok(link.clone())
} else {
if is_gimlet().map_err(ConfigError::SystemDetection)? {
if is_oxide_sled().map_err(ConfigError::SystemDetection)? {
Dladm::list_physical()
.await
.map_err(ConfigError::FindLinks)?
Expand Down
50 changes: 28 additions & 22 deletions sled-agent/src/rack_setup/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ use sled_agent_types::early_networking::{
};
use sled_agent_types::rack_init::{
BootstrapAddressDiscovery, RackInitializeRequest as Config,
RackInitializeRequestParams,
};
use sled_agent_types::rack_ops::RssStep;
use sled_agent_types::sled::StartSledAgentRequest;
Expand Down Expand Up @@ -273,7 +274,7 @@ impl RackSetupService {
/// - `bootstore` - A handle to call bootstore APIs
pub(crate) fn new(
log: Logger,
config: Config,
request: RackInitializeRequestParams,
internal_disks_rx: InternalDisksReceiver,
local_bootstrap_agent: BootstrapAgentHandle,
bootstore: bootstore::NodeHandle,
Expand All @@ -283,7 +284,7 @@ impl RackSetupService {
let svc = ServiceInner::new(log.clone());
if let Err(e) = svc
.run(
&config,
&request,
&internal_disks_rx,
local_bootstrap_agent,
bootstore,
Expand Down Expand Up @@ -1170,14 +1171,16 @@ impl ServiceInner {
// remaining is to handoff to Nexus.
async fn run(
&self,
config: &Config,
request: &RackInitializeRequestParams,
internal_disks_rx: &InternalDisksReceiver,
local_bootstrap_agent: BootstrapAgentHandle,
bootstore: bootstore::NodeHandle,
step_tx: watch::Sender<RssStep>,
) -> Result<(), SetupServiceError> {
info!(self.log, "Injecting RSS configuration: {:#?}", config);
info!(self.log, "Injecting RSS configuration: {:#?}", request);
let mut rss_step = RssProgress::new(step_tx);
let config = &request.rack_initialize_request;
let skip_timesync = request.skip_timesync;

let resolver = DnsResolver::new_from_subnet(
self.log.new(o!("component" => "DnsResolver")),
Expand Down Expand Up @@ -1384,24 +1387,27 @@ impl ServiceInner {
})
.collect();

let ntp_clients = ntp_addresses
.into_iter()
.map(|address| {
let dur = std::time::Duration::from_secs(60);
let client = reqwest::ClientBuilder::new()
.connect_timeout(dur)
.timeout(dur)
.build()
.map_err(SetupServiceError::HttpClient)?;
let client = NtpAdminClient::new_with_client(
&format!("http://{}", address),
client,
self.log.new(o!("NtpAdminClient" => address.to_string())),
);
Ok(client)
})
.collect::<Result<Vec<_>, SetupServiceError>>()?;
self.wait_for_timesync(&ntp_clients).await?;
if !skip_timesync {
let ntp_clients = ntp_addresses
.into_iter()
.map(|address| {
let dur = std::time::Duration::from_secs(60);
let client = reqwest::ClientBuilder::new()
.connect_timeout(dur)
.timeout(dur)
.build()
.map_err(SetupServiceError::HttpClient)?;
let client = NtpAdminClient::new_with_client(
&format!("http://{}", address),
client,
self.log
.new(o!("NtpAdminClient" => address.to_string())),
);
Ok(client)
})
.collect::<Result<Vec<_>, SetupServiceError>>()?;
self.wait_for_timesync(&ntp_clients).await?;
}

info!(self.log, "Finished setting up Internal DNS and NTP");

Expand Down
25 changes: 13 additions & 12 deletions sled-agent/src/services.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ use sled_agent_types::zone_images::{
use sled_agent_zone_images::{ZoneImageSourceResolver, ramdisk_file_source};
use sled_hardware::DendriteAsic;
use sled_hardware::SledMode;
use sled_hardware::is_gimlet;
use sled_hardware::is_oxide_sled;
use sled_hardware::underlay;
use sled_hardware_types::Baseboard;
use slog::Logger;
Expand Down Expand Up @@ -942,7 +942,7 @@ impl ServiceManager {
) -> Result<Vec<(Link, bool)>, Error> {
let mut links: Vec<(Link, bool)> = Vec::new();

let is_gimlet = is_gimlet().map_err(|e| {
let is_oxide_sled = is_oxide_sled().map_err(|e| {
Error::Underlay(underlay::Error::SystemDetection(e))
})?;

Expand All @@ -965,7 +965,7 @@ impl ServiceManager {
links.push((link, false));
}
Err(_) => {
if is_gimlet {
if is_oxide_sled {
return Err(Error::MissingDevice {
device: pkt_source.to_string(),
});
Expand Down Expand Up @@ -2773,11 +2773,11 @@ impl ServiceManager {
);
}

let is_gimlet = is_gimlet().map_err(|e| {
let is_oxide_sled = is_oxide_sled().map_err(|e| {
Error::Underlay(underlay::Error::SystemDetection(e))
})?;

if is_gimlet {
if is_oxide_sled {
// Collect the prefixes for each techport.
let nameaddr = bootstrap_name_and_address.as_ref();
let techport_prefixes = match nameaddr {
Expand Down Expand Up @@ -2806,7 +2806,7 @@ impl ServiceManager {
}
};

if is_gimlet
if is_oxide_sled
|| asic == &DendriteAsic::SoftNpuPropolisDevice
|| asic == &DendriteAsic::TofinoAsic
{
Expand Down Expand Up @@ -2974,11 +2974,12 @@ impl ServiceManager {
}
}

let is_gimlet = is_gimlet().map_err(|e| {
let is_oxide_sled = is_oxide_sled().map_err(|e| {
Error::Underlay(underlay::Error::SystemDetection(e))
})?;

let maghemite_interfaces: Vec<AddrObject> = if is_gimlet {
let maghemite_interfaces: Vec<AddrObject> = if is_oxide_sled
{
(0..32)
.map(|i| {
// See the `tfport_name` function
Expand Down Expand Up @@ -3022,7 +3023,7 @@ impl ServiceManager {
);
}

if is_gimlet {
if is_oxide_sled {
mg_ddm_config = mg_ddm_config
.add_property("dpd_host", "astring", "[::1]")
.add_property(
Expand Down Expand Up @@ -3159,9 +3160,9 @@ impl ServiceManager {
let mut data_links: Vec<String> = vec![];

let services = match self.inner.sled_mode {
// A pure gimlet sled should not be trying to activate a switch
// zone.
SledMode::Gimlet => {
// A sled that is not a scrimlet should not try to activate a
// switch zone.
SledMode::Sled => {
return Err(Error::SwitchZone(anyhow::anyhow!(
"attempted to activate switch zone on non-scrimlet sled"
)));
Expand Down
Loading
Loading