Skip to content

Commit 15be16f

Browse files
committed
sled-agent: begin incorporating Cosmo support
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 68bfc4b commit 15be16f

File tree

20 files changed

+252
-119
lines changed

20 files changed

+252
-119
lines changed

clients/bootstrap-agent-client/src/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ impl From<types::Baseboard> for sled_hardware_types::Baseboard {
4444
identifier, model, revision,
4545
)
4646
}
47+
types::Baseboard::Cosmo { identifier, model, revision } => {
48+
sled_hardware_types::Baseboard::new_cosmo(
49+
identifier, model, revision,
50+
)
51+
}
4752
types::Baseboard::Unknown => {
4853
sled_hardware_types::Baseboard::unknown()
4954
}
@@ -62,6 +67,11 @@ impl From<sled_hardware_types::Baseboard> for types::Baseboard {
6267
model,
6368
revision,
6469
} => types::Baseboard::Gimlet { identifier, model, revision },
70+
sled_hardware_types::Baseboard::Cosmo {
71+
identifier,
72+
model,
73+
revision,
74+
} => types::Baseboard::Cosmo { identifier, model, revision },
6575
sled_hardware_types::Baseboard::Unknown => {
6676
types::Baseboard::Unknown
6777
}

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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,8 @@ 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, .. }
631+
| Baseboard::Cosmo { identifier, model, .. } => {
631632
Some(Self::normalize_item(
632633
&mut self.baseboards,
633634
BaseboardId {

openapi/bootstrap-agent.json

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@
209209
"pattern": "^[a-zA-Z0-9._+-]{1,63}$"
210210
},
211211
"Baseboard": {
212-
"description": "Describes properties that should uniquely identify a Gimlet.",
212+
"description": "Describes properties that should uniquely identify a Sled.",
213213
"oneOf": [
214214
{
215215
"type": "object",
@@ -239,6 +239,34 @@
239239
"type"
240240
]
241241
},
242+
{
243+
"type": "object",
244+
"properties": {
245+
"identifier": {
246+
"type": "string"
247+
},
248+
"model": {
249+
"type": "string"
250+
},
251+
"revision": {
252+
"type": "integer",
253+
"format": "uint32",
254+
"minimum": 0
255+
},
256+
"type": {
257+
"type": "string",
258+
"enum": [
259+
"cosmo"
260+
]
261+
}
262+
},
263+
"required": [
264+
"identifier",
265+
"model",
266+
"revision",
267+
"type"
268+
]
269+
},
242270
{
243271
"type": "object",
244272
"properties": {

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,13 @@ async fn do_run() -> Result<(), CmdError> {
6161
rss_config_path
6262
};
6363
let rss_config = if rss_config_path.exists() {
64-
Some(
64+
let mut rss_config =
6565
RackInitializeRequest::from_file(rss_config_path)
66-
.map_err(|e| CmdError::Failure(anyhow!(e)))?,
67-
)
66+
.map_err(|e| CmdError::Failure(anyhow!(e)))?;
67+
if rss_config.skip_timesync.is_none() {
68+
rss_config.skip_timesync = config.skip_timesync;
69+
}
70+
Some(rss_config)
6871
} else {
6972
None
7073
};

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/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/plan/service.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,6 +1259,7 @@ mod tests {
12591259
bfd: Vec::new(),
12601260
},
12611261
allowed_source_ips: AllowedSourceIps::Any,
1262+
skip_timesync: Some(false),
12621263
}
12631264
}
12641265

sled-agent/src/rack_setup/service.rs

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,24 +1384,28 @@ impl ServiceInner {
13841384
})
13851385
.collect();
13861386

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

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

sled-agent/src/services.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ use sled_agent_types::zone_images::{
9999
use sled_agent_zone_images::{ZoneImageSourceResolver, ramdisk_file_source};
100100
use sled_hardware::DendriteAsic;
101101
use sled_hardware::SledMode;
102-
use sled_hardware::is_gimlet;
102+
use sled_hardware::is_oxide_sled;
103103
use sled_hardware::underlay;
104104
use sled_hardware_types::Baseboard;
105105
use slog::Logger;
@@ -942,7 +942,7 @@ impl ServiceManager {
942942
) -> Result<Vec<(Link, bool)>, Error> {
943943
let mut links: Vec<(Link, bool)> = Vec::new();
944944

945-
let is_gimlet = is_gimlet().map_err(|e| {
945+
let is_oxide_sled = is_oxide_sled().map_err(|e| {
946946
Error::Underlay(underlay::Error::SystemDetection(e))
947947
})?;
948948

@@ -965,7 +965,7 @@ impl ServiceManager {
965965
links.push((link, false));
966966
}
967967
Err(_) => {
968-
if is_gimlet {
968+
if is_oxide_sled {
969969
return Err(Error::MissingDevice {
970970
device: pkt_source.to_string(),
971971
});
@@ -2773,11 +2773,11 @@ impl ServiceManager {
27732773
);
27742774
}
27752775

2776-
let is_gimlet = is_gimlet().map_err(|e| {
2776+
let is_oxide_sled = is_oxide_sled().map_err(|e| {
27772777
Error::Underlay(underlay::Error::SystemDetection(e))
27782778
})?;
27792779

2780-
if is_gimlet {
2780+
if is_oxide_sled {
27812781
// Collect the prefixes for each techport.
27822782
let nameaddr = bootstrap_name_and_address.as_ref();
27832783
let techport_prefixes = match nameaddr {
@@ -2806,7 +2806,7 @@ impl ServiceManager {
28062806
}
28072807
};
28082808

2809-
if is_gimlet
2809+
if is_oxide_sled
28102810
|| asic == &DendriteAsic::SoftNpuPropolisDevice
28112811
|| asic == &DendriteAsic::TofinoAsic
28122812
{
@@ -2842,6 +2842,7 @@ impl ServiceManager {
28422842

28432843
match baseboard {
28442844
Baseboard::Gimlet { identifier, model, .. }
2845+
| Baseboard::Cosmo { identifier, model, .. }
28452846
| Baseboard::Pc { identifier, model, .. } => {
28462847
lldpd_config = lldpd_config
28472848
.add_property(
@@ -2974,11 +2975,12 @@ impl ServiceManager {
29742975
}
29752976
}
29762977

2977-
let is_gimlet = is_gimlet().map_err(|e| {
2978+
let is_oxide_sled = is_oxide_sled().map_err(|e| {
29782979
Error::Underlay(underlay::Error::SystemDetection(e))
29792980
})?;
29802981

2981-
let maghemite_interfaces: Vec<AddrObject> = if is_gimlet {
2982+
let maghemite_interfaces: Vec<AddrObject> = if is_oxide_sled
2983+
{
29822984
(0..32)
29832985
.map(|i| {
29842986
// See the `tfport_name` function
@@ -3022,7 +3024,7 @@ impl ServiceManager {
30223024
);
30233025
}
30243026

3025-
if is_gimlet {
3027+
if is_oxide_sled {
30263028
mg_ddm_config = mg_ddm_config
30273029
.add_property("dpd_host", "astring", "[::1]")
30283030
.add_property(
@@ -3161,7 +3163,7 @@ impl ServiceManager {
31613163
let services = match self.inner.sled_mode {
31623164
// A pure gimlet sled should not be trying to activate a switch
31633165
// zone.
3164-
SledMode::Gimlet => {
3166+
SledMode::Sled => {
31653167
return Err(Error::SwitchZone(anyhow::anyhow!(
31663168
"attempted to activate switch zone on non-scrimlet sled"
31673169
)));

0 commit comments

Comments
 (0)