Skip to content

Commit c3ea904

Browse files
authored
sled-agent: begin incorporating Cosmo support (#9016)
Extend the existing `Baseboard` type to incorporate Cosmo, and introduce a new `OxideSled` enum to represent different Oxide sled types so that a) we can differentiate between different kinds of sled, and b) parameterize omicron code with constant data specific to a sled type. Also, identify places where we call the `is_gimlet` method, and instead call that, `is_oxide_sled` (none of these are actually specific to Gimlets in particular). Find places where we use symbolic constants named `Gimlet` that should be `Sled`; if these bleed into config files, set up Serde aliases to accommodate a change. Make it is that, if we set `skip_timesync` in a config file, we propagate that to RSS config as well. With these changes, we have successfully used the `gimlet-standalone` to boot the control plane on a Cosmo. (Yes, the config name is somewhat ironic, and should be addressed at some point.)
1 parent c698911 commit c3ea904

File tree

20 files changed

+273
-154
lines changed

20 files changed

+273
-154
lines changed

installinator/src/hardware.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ pub struct Hardware {
2121

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

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

3636
info!(
37-
log, "found gimlet hardware";
37+
log, "found oxide sled hardware";
3838
"baseboard" => ?hardware.baseboard(),
3939
"is_scrimlet" => hardware.is_scrimlet(),
4040
"num_disks" => disks.len(),

nexus/inventory/src/builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ impl CollectionBuilder {
627627

628628
let baseboard_id = match inventory.baseboard {
629629
Baseboard::Pc { .. } => None,
630-
Baseboard::Gimlet { identifier, model, revision: _ } => {
630+
Baseboard::Gimlet { identifier, model, .. } => {
631631
Some(Self::normalize_item(
632632
&mut self.baseboards,
633633
BaseboardId {

sled-agent/src/bin/sled-agent.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ use omicron_common::cmd::fatal;
1212
use omicron_sled_agent::bootstrap::RssAccessError;
1313
use omicron_sled_agent::bootstrap::server as bootstrap_server;
1414
use omicron_sled_agent::config::Config as SledConfig;
15-
use sled_agent_types::rack_init::RackInitializeRequest;
15+
use sled_agent_types::rack_init::{
16+
RackInitializeRequest, RackInitializeRequestParams,
17+
};
1618

1719
#[derive(Debug, Parser)]
1820
#[clap(
@@ -60,14 +62,13 @@ async fn do_run() -> Result<(), CmdError> {
6062
rss_config_path.push("config-rss.toml");
6163
rss_config_path
6264
};
63-
let rss_config = if rss_config_path.exists() {
64-
Some(
65+
let rss_config = rss_config_path.exists().then_some({
66+
let rss_config =
6567
RackInitializeRequest::from_file(rss_config_path)
66-
.map_err(|e| CmdError::Failure(anyhow!(e)))?,
67-
)
68-
} else {
69-
None
70-
};
68+
.map_err(|e| CmdError::Failure(anyhow!(e)))?;
69+
let skip_timesync = config.skip_timesync.unwrap_or(false);
70+
RackInitializeRequestParams::new(rss_config, skip_timesync)
71+
});
7172

7273
let server = bootstrap_server::Server::start(config)
7374
.await

sled-agent/src/bootstrap/http_entrypoints.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ use omicron_common::api::external::Error;
2424
use omicron_uuid_kinds::RackInitUuid;
2525
use omicron_uuid_kinds::RackResetUuid;
2626
use sled_agent_config_reconciler::InternalDisksReceiver;
27-
use sled_agent_types::rack_init::RackInitializeRequest;
27+
use sled_agent_types::rack_init::{
28+
RackInitializeRequest, RackInitializeRequestParams,
29+
};
2830
use sled_agent_types::rack_ops::RackOperationStatus;
2931
use sled_hardware_types::Baseboard;
3032
use slog::Logger;
@@ -50,7 +52,7 @@ pub(crate) struct BootstrapServerContext {
5052
impl BootstrapServerContext {
5153
pub(super) fn start_rack_initialize(
5254
&self,
53-
request: RackInitializeRequest,
55+
request: RackInitializeRequestParams,
5456
) -> Result<RackInitUuid, RssAccessError> {
5557
self.rss_access.start_initializing(
5658
&self.base_log,
@@ -106,8 +108,13 @@ impl BootstrapAgentApi for BootstrapAgentImpl {
106108
rqctx: RequestContext<Self::Context>,
107109
body: TypedBody<RackInitializeRequest>,
108110
) -> Result<HttpResponseOk<RackInitUuid>, HttpError> {
111+
// Note that if we are performing rack initialization in
112+
// response to an external request, we assume we are not
113+
// skipping timesync.
114+
const SKIP_TIMESYNC: bool = false;
109115
let ctx = rqctx.context();
110-
let request = body.into_inner();
116+
let request =
117+
RackInitializeRequestParams::new(body.into_inner(), SKIP_TIMESYNC);
111118
let id = ctx
112119
.start_rack_initialize(request)
113120
.map_err(|err| HttpError::for_bad_request(None, err.to_string()))?;

sled-agent/src/bootstrap/pre_server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ fn sled_mode_from_config(config: &Config) -> Result<SledMode, StartError> {
303303
}
304304
SledMode::Auto
305305
}
306-
SledModeConfig::Gimlet => SledMode::Gimlet,
306+
SledModeConfig::Sled => SledMode::Sled,
307307
SledModeConfig::Scrimlet => {
308308
let asic = if cfg!(feature = "switch-asic") {
309309
DendriteAsic::TofinoAsic

sled-agent/src/bootstrap/rack_ops.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use bootstore::schemes::v0 as bootstore;
1010
use omicron_uuid_kinds::RackInitUuid;
1111
use omicron_uuid_kinds::RackResetUuid;
1212
use sled_agent_config_reconciler::InternalDisksReceiver;
13-
use sled_agent_types::rack_init::RackInitializeRequest;
13+
use sled_agent_types::rack_init::RackInitializeRequestParams;
1414
use sled_agent_types::rack_ops::{RackOperationStatus, RssStep};
1515
use slog::Logger;
1616
use sprockets_tls::keys::SprocketsConfig;
@@ -148,7 +148,7 @@ impl RssAccess {
148148
global_zone_bootstrap_ip: Ipv6Addr,
149149
internal_disks_rx: &InternalDisksReceiver,
150150
bootstore_node_handle: &bootstore::NodeHandle,
151-
request: RackInitializeRequest,
151+
request: RackInitializeRequestParams,
152152
) -> Result<RackInitUuid, RssAccessError> {
153153
let mut status = self.status.lock().unwrap();
154154

@@ -330,7 +330,7 @@ async fn rack_initialize(
330330
global_zone_bootstrap_ip: Ipv6Addr,
331331
internal_disks_rx: InternalDisksReceiver,
332332
bootstore_node_handle: bootstore::NodeHandle,
333-
request: RackInitializeRequest,
333+
request: RackInitializeRequestParams,
334334
step_tx: watch::Sender<RssStep>,
335335
) -> Result<(), SetupServiceError> {
336336
RssHandle::run_rss(

sled-agent/src/bootstrap/rss_handle.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use omicron_common::backoff::BackoffError;
1515
use omicron_common::backoff::retry_notify;
1616
use omicron_common::backoff::retry_policy_local;
1717
use sled_agent_config_reconciler::InternalDisksReceiver;
18-
use sled_agent_types::rack_init::RackInitializeRequest;
18+
use sled_agent_types::rack_init::RackInitializeRequestParams;
1919
use sled_agent_types::rack_ops::RssStep;
2020
use sled_agent_types::sled::StartSledAgentRequest;
2121
use slog::Logger;
@@ -48,7 +48,7 @@ impl RssHandle {
4848
pub(super) async fn run_rss(
4949
log: &Logger,
5050
sprockets: SprocketsConfig,
51-
config: RackInitializeRequest,
51+
config: RackInitializeRequestParams,
5252
our_bootstrap_address: Ipv6Addr,
5353
internal_disks_rx: InternalDisksReceiver,
5454
bootstore: bootstore::NodeHandle,

sled-agent/src/bootstrap/server.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ use omicron_uuid_kinds::GenericUuid;
4141
use omicron_uuid_kinds::RackInitUuid;
4242
use sled_agent_config_reconciler::ConfigReconcilerSpawnToken;
4343
use sled_agent_config_reconciler::InternalDisksReceiver;
44-
use sled_agent_types::rack_init::RackInitializeRequest;
44+
use sled_agent_types::rack_init::RackInitializeRequestParams;
4545
use sled_agent_types::sled::StartSledAgentRequest;
4646
use sled_hardware::underlay;
4747
use sled_storage::dataset::CONFIG_DATASET;
@@ -290,7 +290,7 @@ impl Server {
290290

291291
pub fn start_rack_initialize(
292292
&self,
293-
request: RackInitializeRequest,
293+
request: RackInitializeRequestParams,
294294
) -> Result<RackInitUuid, RssAccessError> {
295295
self.bootstrap_http_server.app_private().start_rack_initialize(request)
296296
}
@@ -594,8 +594,8 @@ impl Inner {
594594
let initial = server.sled_agent().start_request();
595595
let response = if initial != &request {
596596
Err(format!(
597-
"Sled Agent already running:
598-
initital request = {:?},
597+
"Sled Agent already running:
598+
initital request = {:?},
599599
current request: {:?}",
600600
initial, request
601601
))

sled-agent/src/config.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ use illumos_utils::dladm::PhysicalLink;
1515
use omicron_common::vlan::VlanID;
1616
use serde::Deserialize;
1717
use sled_hardware::UnparsedDisk;
18-
use sled_hardware::is_gimlet;
18+
use sled_hardware::is_oxide_sled;
1919
use sprockets_tls::keys::SprocketsConfig;
2020

2121
#[derive(Clone, Debug, Deserialize)]
2222
#[serde(rename_all = "lowercase")]
2323
pub enum SledMode {
2424
Auto,
25-
Gimlet,
25+
#[serde(alias = "gimlet")]
26+
Sled,
2627
Scrimlet,
2728
}
2829

@@ -137,7 +138,7 @@ pub enum ConfigError {
137138
},
138139
#[error("Loading certificate: {0}")]
139140
Certificate(#[source] anyhow::Error),
140-
#[error("Could not determine if host is a Gimlet: {0}")]
141+
#[error("Could not determine if host is an Oxide sled: {0}")]
141142
SystemDetection(#[source] anyhow::Error),
142143
#[error("Could not enumerate physical links")]
143144
FindLinks(#[from] FindPhysicalLinkError),
@@ -158,7 +159,7 @@ impl Config {
158159
if let Some(link) = self.data_link.as_ref() {
159160
Ok(link.clone())
160161
} else {
161-
if is_gimlet().map_err(ConfigError::SystemDetection)? {
162+
if is_oxide_sled().map_err(ConfigError::SystemDetection)? {
162163
Dladm::list_physical()
163164
.await
164165
.map_err(ConfigError::FindLinks)?

sled-agent/src/rack_setup/service.rs

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ use sled_agent_types::early_networking::{
129129
};
130130
use sled_agent_types::rack_init::{
131131
BootstrapAddressDiscovery, RackInitializeRequest as Config,
132+
RackInitializeRequestParams,
132133
};
133134
use sled_agent_types::rack_ops::RssStep;
134135
use sled_agent_types::sled::StartSledAgentRequest;
@@ -273,7 +274,7 @@ impl RackSetupService {
273274
/// - `bootstore` - A handle to call bootstore APIs
274275
pub(crate) fn new(
275276
log: Logger,
276-
config: Config,
277+
request: RackInitializeRequestParams,
277278
internal_disks_rx: InternalDisksReceiver,
278279
local_bootstrap_agent: BootstrapAgentHandle,
279280
bootstore: bootstore::NodeHandle,
@@ -283,7 +284,7 @@ impl RackSetupService {
283284
let svc = ServiceInner::new(log.clone());
284285
if let Err(e) = svc
285286
.run(
286-
&config,
287+
&request,
287288
&internal_disks_rx,
288289
local_bootstrap_agent,
289290
bootstore,
@@ -1170,14 +1171,16 @@ impl ServiceInner {
11701171
// remaining is to handoff to Nexus.
11711172
async fn run(
11721173
&self,
1173-
config: &Config,
1174+
request: &RackInitializeRequestParams,
11741175
internal_disks_rx: &InternalDisksReceiver,
11751176
local_bootstrap_agent: BootstrapAgentHandle,
11761177
bootstore: bootstore::NodeHandle,
11771178
step_tx: watch::Sender<RssStep>,
11781179
) -> Result<(), SetupServiceError> {
1179-
info!(self.log, "Injecting RSS configuration: {:#?}", config);
1180+
info!(self.log, "Injecting RSS configuration: {:#?}", request);
11801181
let mut rss_step = RssProgress::new(step_tx);
1182+
let config = &request.rack_initialize_request;
1183+
let skip_timesync = request.skip_timesync;
11811184

11821185
let resolver = DnsResolver::new_from_subnet(
11831186
self.log.new(o!("component" => "DnsResolver")),
@@ -1384,24 +1387,27 @@ impl ServiceInner {
13841387
})
13851388
.collect();
13861389

1387-
let ntp_clients = ntp_addresses
1388-
.into_iter()
1389-
.map(|address| {
1390-
let dur = std::time::Duration::from_secs(60);
1391-
let client = reqwest::ClientBuilder::new()
1392-
.connect_timeout(dur)
1393-
.timeout(dur)
1394-
.build()
1395-
.map_err(SetupServiceError::HttpClient)?;
1396-
let client = NtpAdminClient::new_with_client(
1397-
&format!("http://{}", address),
1398-
client,
1399-
self.log.new(o!("NtpAdminClient" => address.to_string())),
1400-
);
1401-
Ok(client)
1402-
})
1403-
.collect::<Result<Vec<_>, SetupServiceError>>()?;
1404-
self.wait_for_timesync(&ntp_clients).await?;
1390+
if !skip_timesync {
1391+
let ntp_clients = ntp_addresses
1392+
.into_iter()
1393+
.map(|address| {
1394+
let dur = std::time::Duration::from_secs(60);
1395+
let client = reqwest::ClientBuilder::new()
1396+
.connect_timeout(dur)
1397+
.timeout(dur)
1398+
.build()
1399+
.map_err(SetupServiceError::HttpClient)?;
1400+
let client = NtpAdminClient::new_with_client(
1401+
&format!("http://{}", address),
1402+
client,
1403+
self.log
1404+
.new(o!("NtpAdminClient" => address.to_string())),
1405+
);
1406+
Ok(client)
1407+
})
1408+
.collect::<Result<Vec<_>, SetupServiceError>>()?;
1409+
self.wait_for_timesync(&ntp_clients).await?;
1410+
}
14051411

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

0 commit comments

Comments
 (0)