Skip to content

Commit

Permalink
Update SMF properties for Dendrite to include sled identifiers
Browse files Browse the repository at this point in the history
Includes:

- package-manifest update to match the properties added to dpd
- removal of client call to get sled idenifier information (no longer used)
- switch_slot added to oximeter schemas for dendrite/switch-data-link
  • Loading branch information
zeeshanlakhani committed Oct 10, 2024
1 parent 809c454 commit f1bac1a
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 61 deletions.
30 changes: 0 additions & 30 deletions clients/sled-agent-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,36 +389,6 @@ impl From<omicron_common::api::internal::shared::NetworkInterfaceKind>
}
}

impl From<omicron_common::api::internal::shared::SledIdentifiers>
for types::SledIdentifiers
{
fn from(
value: omicron_common::api::internal::shared::SledIdentifiers,
) -> Self {
Self {
model: value.model,
rack_id: value.rack_id,
revision: value.revision,
serial: value.serial,
sled_id: value.sled_id,
}
}
}

impl From<types::SledIdentifiers>
for omicron_common::api::internal::shared::SledIdentifiers
{
fn from(value: types::SledIdentifiers) -> Self {
Self {
model: value.model,
rack_id: value.rack_id,
revision: value.revision,
serial: value.serial,
sled_id: value.sled_id,
}
}
}

/// Exposes additional [`Client`] interfaces for use by the test suite. These
/// are bonus endpoints, not generated in the real client.
#[async_trait]
Expand Down
6 changes: 5 additions & 1 deletion oximeter/oximeter/schema/dendrite.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ versions = [
# switch for its statistics, which is why these fields are included.
# Dendrite may eventually report statistics about itself, or other aspects
# not related to the switch, so they belong here, not the target.
{ added_in = 1, fields = [ "switch_model", "switch_revision", "switch_id", "switch_serial" ] }
{ added_in = 1, fields = [ "switch_model", "switch_revision", "switch_id", "switch_serial", "switch_slot" ] }
]

[fields.rack_id]
Expand Down Expand Up @@ -56,3 +56,7 @@ description = "ID of the switch being managed"
[fields.switch_serial]
type = "string"
description = "Serial number of the switch being managed"

[fields.switch_slot]
type = "u32"
description = "Slot number of the switch the link is on"
6 changes: 5 additions & 1 deletion oximeter/oximeter/schema/switch-data-link.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name = "switch_data_link"
description = "A network data link on an Oxide switch"
authz_scope = "fleet"
versions = [
{ version = 1, fields = [ "rack_id", "sled_id", "sled_model", "sled_revision", "sled_serial", "switch_id", "switch_model", "switch_revision", "switch_serial" ] },
{ version = 1, fields = [ "rack_id", "sled_id", "sled_model", "sled_revision", "sled_serial", "switch_id", "switch_model", "switch_revision", "switch_serial", "switch_slot" ] },
]

[[metrics]]
Expand Down Expand Up @@ -263,6 +263,10 @@ description = "Revision number of the switch the link is on"
type = "string"
description = "Serial number of the switch the link is on"

[fields.switch_slot]
type = "u32"
description = "Slot number of the switch the link is on"

[fields.port_id]
type = "string"
description = "Physical switch port the link is on"
Expand Down
12 changes: 6 additions & 6 deletions package-manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -716,8 +716,8 @@ only_for_targets.image = "standard"
# the other `source.*` keys.
source.type = "prebuilt"
source.repo = "dendrite"
source.commit = "f3810e7bc1f0d746b5e95b3aaff32e52b02dfdfa"
source.sha256 = "c1506f6f818327523e6ff3102432a2038d319338b883235664b34f9132ff676a"
source.commit = "f79076d4630895a0177839ea041c355e2589b9c1"
source.sha256 = "7dbd752327234d6321ae9b06fb1eb72874bd3bcf0122ee545f60fe2579d9746c"
output.type = "zone"
output.intermediate_only = true

Expand All @@ -743,8 +743,8 @@ only_for_targets.image = "standard"
# the other `source.*` keys.
source.type = "prebuilt"
source.repo = "dendrite"
source.commit = "f3810e7bc1f0d746b5e95b3aaff32e52b02dfdfa"
source.sha256 = "061d40085e733e60d7c53ebfd2a4cf64f54a856e7eb5fd4b82ac65ec6a5b847b"
source.commit = "f79076d4630895a0177839ea041c355e2589b9c1"
source.sha256 = "12d02211398203d56b48bfe5dbcad1a4e968a5627e94bd1093b45d77181038fe"
output.type = "zone"
output.intermediate_only = true

Expand All @@ -763,8 +763,8 @@ only_for_targets.image = "standard"
# the other `source.*` keys.
source.type = "prebuilt"
source.repo = "dendrite"
source.commit = "f3810e7bc1f0d746b5e95b3aaff32e52b02dfdfa"
source.sha256 = "c6cb4c077f0ddfc78ab06e07316d1312657f95526ced60c2b8e7baf1c73ae24a"
source.commit = "f79076d4630895a0177839ea041c355e2589b9c1"
source.sha256 = "b128356fd2986344b393ca178ee7e7fc7aa82c08a85b4088e3df61ab057263f3"
output.type = "zone"
output.intermediate_only = true

Expand Down
87 changes: 74 additions & 13 deletions sled-agent/src/services.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ use omicron_common::address::{AZ_PREFIX, OXIMETER_PORT};
use omicron_common::address::{BOOTSTRAP_ARTIFACT_PORT, COCKROACH_ADMIN_PORT};
use omicron_common::api::external::Generation;
use omicron_common::api::internal::shared::{
HostPortConfig, RackNetworkConfig,
HostPortConfig, RackNetworkConfig, SledIdentifiers,
};
use omicron_common::backoff::{
retry_notify, retry_policy_internal_service_aggressive, BackoffError,
Expand Down Expand Up @@ -379,15 +379,18 @@ fn display_zone_init_errors(errors: &[(String, Box<Error>)]) -> String {
/// Configuration parameters which modify the [`ServiceManager`]'s behavior.
pub struct Config {
/// Identifies the sled being configured
pub sled_id: Uuid,
pub sled_identifiers: SledIdentifiers,

/// Identifies the revision of the sidecar to be used.
pub sidecar_revision: SidecarRevision,
}

impl Config {
pub fn new(sled_id: Uuid, sidecar_revision: SidecarRevision) -> Self {
Self { sled_id, sidecar_revision }
pub fn new(
sled_identifiers: SledIdentifiers,
sidecar_revision: SidecarRevision,
) -> Self {
Self { sled_identifiers, sidecar_revision }
}
}

Expand Down Expand Up @@ -973,6 +976,7 @@ impl ServiceManager {
.get()
.expect("sled agent not started")
.config
.sled_identifiers
.sled_id
}

Expand Down Expand Up @@ -2705,15 +2709,42 @@ impl ServiceManager {

if let Some(i) = info {
dendrite_config = dendrite_config
.add_property(
"rack_id",
"astring",
&i.rack_id.to_string(),
)
.add_property(
"sled_id",
"astring",
&i.config.sled_id.to_string(),
&i.config
.sled_identifiers
.sled_id
.to_string(),
)
.add_property(
"rack_id",
"sled_model",
"astring",
&i.rack_id.to_string(),
&i.config
.sled_identifiers
.model
.to_string(),
)
.add_property(
"sled_serial",
"astring",
&i.config
.sled_identifiers
.serial
.to_string(),
)
.add_property(
"sled_revision",
"astring",
&i.config
.sled_identifiers
.revision
.to_string(),
);
}

Expand Down Expand Up @@ -3005,7 +3036,10 @@ impl ServiceManager {
.add_property(
"sled_uuid",
"astring",
&i.config.sled_id.to_string(),
&i.config
.sled_identifiers
.sled_id
.to_string(),
)
.add_property(
"rack_uuid",
Expand Down Expand Up @@ -3051,7 +3085,10 @@ impl ServiceManager {
.add_property(
"sled_uuid",
"astring",
&i.config.sled_id.to_string(),
&i.config
.sled_identifiers
.sled_id
.to_string(),
)
.add_property(
"rack_uuid",
Expand Down Expand Up @@ -4386,7 +4423,25 @@ impl ServiceManager {
)?;
smfh.setprop_default_instance(
"config/sled_id",
info.config.sled_id,
info.config.sled_identifiers.sled_id,
)?;
smfh.setprop_default_instance(
"config/sled_model",
info.config
.sled_identifiers
.model
.to_string(),
)?;
smfh.setprop_default_instance(
"config/sled_revision",
info.config.sled_identifiers.revision,
)?;
smfh.setprop_default_instance(
"config/sled_serial",
info.config
.sled_identifiers
.serial
.to_string(),
)?;
} else {
info!(
Expand Down Expand Up @@ -4495,7 +4550,7 @@ impl ServiceManager {
)?;
smfh.setprop_default_instance(
"config/sled_uuid",
info.config.sled_id,
info.config.sled_identifiers.sled_id,
)?;
}
for address in &request.addresses {
Expand Down Expand Up @@ -4538,7 +4593,7 @@ impl ServiceManager {
)?;
smfh.setprop_default_instance(
"config/sled_uuid",
info.config.sled_id,
info.config.sled_identifiers.sled_id,
)?;
}
smfh.delpropvalue_default_instance(
Expand Down Expand Up @@ -4981,7 +5036,13 @@ mod illumos_tests {

fn make_config(&self) -> Config {
Config {
sled_id: Uuid::new_v4(),
sled_identifiers: SledIdentifiers {
rack_id: Uuid::new_v4(),
sled_id: Uuid::new_v4(),
model: "fake-gimlet".to_string(),
revision: 1,
serial: "fake-serial".to_string(),
},
sidecar_revision: SidecarRevision::Physical(
"rev_whatever_its_a_test".to_string(),
),
Expand Down
8 changes: 3 additions & 5 deletions sled-agent/src/sled_agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ impl SledAgent {
serial: baseboard.identifier().to_string(),
};
let metrics_manager =
MetricsManager::new(&log, identifiers, *sled_address.ip())?;
MetricsManager::new(&log, identifiers.clone(), *sled_address.ip())?;

// Start tracking the underlay physical links.
for link in underlay::find_chelsio_links(&config.data_links)? {
Expand Down Expand Up @@ -497,10 +497,8 @@ impl SledAgent {
};
let updates = UpdateManager::new(update_config);

let svc_config = services::Config::new(
request.body.id.into_untyped_uuid(),
config.sidecar_revision.clone(),
);
let svc_config =
services::Config::new(identifiers, config.sidecar_revision.clone());

// Get our rack network config from the bootstore; we cannot proceed
// until we have this, as we need to know which switches have uplinks to
Expand Down
4 changes: 2 additions & 2 deletions tools/dendrite_openapi_version
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
COMMIT="f3810e7bc1f0d746b5e95b3aaff32e52b02dfdfa"
SHA2="3a54305ab4b1270c9a5fb0603f481fce199f3767c174a03559ff642f7f44687e"
COMMIT="f79076d4630895a0177839ea041c355e2589b9c1"
SHA2="d1a503d99fe7e12dfe20f83031a8ce718a28d5caa88c41d2ceb298ed287acb4e"
6 changes: 3 additions & 3 deletions tools/dendrite_stub_checksums
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
CIDL_SHA256_ILLUMOS="c1506f6f818327523e6ff3102432a2038d319338b883235664b34f9132ff676a"
CIDL_SHA256_LINUX_DPD="fc9ea4dc22e761dce3aa4d252983360f799426a0c23ea8f347653664d3e2b55a"
CIDL_SHA256_LINUX_SWADM="9da0dd6c972206338971a90144b1c35e101d69aaacf26240a45cef45d828b090"
CIDL_SHA256_ILLUMOS="7dbd752327234d6321ae9b06fb1eb72874bd3bcf0122ee545f60fe2579d9746c"
CIDL_SHA256_LINUX_DPD="6ffcebe792c268754352c29436d032027123ff33ee45fc9dfa4fe284e5eb0cec"
CIDL_SHA256_LINUX_SWADM="d6d9c42411cead6d823f21ba3082001595a4b47c7b8ec35f323bbe22eb8fa40a"

0 comments on commit f1bac1a

Please sign in to comment.