Skip to content

Commit

Permalink
services cleanup and dendrite update
Browse files Browse the repository at this point in the history
  • Loading branch information
zeeshanlakhani committed Nov 1, 2024
1 parent 819eded commit 7b361fa
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 145 deletions.
12 changes: 6 additions & 6 deletions package-manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -717,8 +717,8 @@ only_for_targets.image = "standard"
# the other `source.*` keys.
source.type = "prebuilt"
source.repo = "dendrite"
source.commit = "a502a30b43b32ad4c884ab4e1e6d87bc01387166"
source.sha256 = "a79cc46ce4a994ca245c8d52f157521c4c32399ae8b6e6dbb4b54126c7d6dc6b"
source.commit = "0647fb31bdee8d0beee760961dcdb549e4a9c450"
source.sha256 = "b06803d6d788f1b6ba4200548bb5f976dc043481837ecff20e6c1095235bbe82"
output.type = "zone"
output.intermediate_only = true

Expand All @@ -744,8 +744,8 @@ only_for_targets.image = "standard"
# the other `source.*` keys.
source.type = "prebuilt"
source.repo = "dendrite"
source.commit = "a502a30b43b32ad4c884ab4e1e6d87bc01387166"
source.sha256 = "05ae723439b432f66e76427805bb2d0fa28603dc28c22624f2a6f872fa6b3627"
source.commit = "0647fb31bdee8d0beee760961dcdb549e4a9c450"
source.sha256 = "47b771e6159ab6cd4b90998c767cb1cc9c82e6554493147711a4a57a5302ffd8"
output.type = "zone"
output.intermediate_only = true

Expand All @@ -764,8 +764,8 @@ only_for_targets.image = "standard"
# the other `source.*` keys.
source.type = "prebuilt"
source.repo = "dendrite"
source.commit = "a502a30b43b32ad4c884ab4e1e6d87bc01387166"
source.sha256 = "982a28193410e1641e0f8ac015c294610dc1bfd162bae8e68b9ba8ebf3800e75"
source.commit = "0647fb31bdee8d0beee760961dcdb549e4a9c450"
source.sha256 = "edbd01f1ad1e5e7d12a96eaffe6efd5d40c194d39427c633ea385f8f98faad14"
output.type = "zone"
output.intermediate_only = true

Expand Down
207 changes: 73 additions & 134 deletions sled-agent/src/services.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,63 @@ fn display_zone_init_errors(errors: &[(String, Box<Error>)]) -> String {
output
}

/// Helper function to add properties to a PropertyGroupBuilder for a sled
/// agent centered around rack and sled identifiers.
fn add_sled_ident_properties(
config: PropertyGroupBuilder,
info: &SledAgentInfo,
) -> PropertyGroupBuilder {
config
.add_property("rack_id", "astring", &info.rack_id.to_string())
.add_property(
"sled_id",
"astring",
&info.config.sled_identifiers.sled_id.to_string(),
)
.add_property(
"sled_model",
"astring",
&info.config.sled_identifiers.model.to_string(),
)
.add_property(
"sled_serial",
"astring",
&info.config.sled_identifiers.serial.to_string(),
)
.add_property(
"sled_revision",
"astring",
&info.config.sled_identifiers.revision.to_string(),
)
}

/// Helper function to set properties on a SmfHelper for a sled agent centered
/// around rack and sled identifiers.
fn setprop_sled_ident_properties(
smfh: &SmfHelper,
info: &SledAgentInfo,
) -> Result<(), Error> {
smfh.setprop_default_instance("config/rack_id", info.rack_id)?;
smfh.setprop_default_instance(
"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(),
)?;

Ok(())
}

/// Configuration parameters which modify the [`ServiceManager`]'s behavior.
pub struct Config {
/// Identifies the sled being configured
Expand Down Expand Up @@ -2689,45 +2746,11 @@ impl ServiceManager {
PropertyGroupBuilder::new("config");

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_identifiers
.sled_id
.to_string(),
)
.add_property(
"sled_model",
"astring",
&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(),
);
}
dendrite_config = add_sled_ident_properties(
dendrite_config,
i,
)
};

for address in addresses {
dendrite_config = dendrite_config.add_property(
Expand Down Expand Up @@ -2852,64 +2875,30 @@ impl ServiceManager {
}
SwitchService::Tfport { pkt_source, asic } => {
info!(self.inner.log, "Setting up tfport service");

let mut tfport_config =
PropertyGroupBuilder::new("config");

tfport_config = tfport_config
.add_property(
"host",
"dpd_host",
"astring",
&format!("[{}]", Ipv6Addr::LOCALHOST),
)
.add_property(
"port",
"dpd_port",
"astring",
&format!("{}", DENDRITE_PORT),
);

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

for address in addresses {
tfport_config = tfport_config.add_property(
"address",
"listen_address",
"astring",
&format!("[{}]:{}", address, TFPORTD_PORT),
);
Expand Down Expand Up @@ -4449,32 +4438,7 @@ impl ServiceManager {
"configuring dendrite service"
);
if let Some(info) = self.inner.sled_info.get() {
smfh.setprop_default_instance(
"config/rack_id",
info.rack_id,
)?;
smfh.setprop_default_instance(
"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(),
)?;
setprop_sled_ident_properties(&smfh, info)?;
} else {
info!(
self.inner.log,
Expand Down Expand Up @@ -4555,45 +4519,20 @@ impl ServiceManager {
SwitchService::Tfport { pkt_source, asic } => {
info!(self.inner.log, "configuring tfport service");
if let Some(info) = self.inner.sled_info.get() {
smfh.setprop_default_instance(
"config/rack_id",
info.rack_id,
)?;
smfh.setprop_default_instance(
"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(),
)?;
setprop_sled_ident_properties(&smfh, info)?;
} else {
info!(
self.inner.log,
"no sled info available yet"
);
}
smfh.delpropvalue_default_instance(
"config/address",
"config/listen_address",
"*",
)?;
for address in &request.addresses {
smfh.addpropvalue_type_default_instance(
"config/address",
"config/listen_address",
&format!("[{}]:{}", address, TFPORTD_PORT),
"astring",
)?;
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="a502a30b43b32ad4c884ab4e1e6d87bc01387166"
SHA2="b1bcf5ad3c2ce556d861367aa2942340a7ccfe592c83e96dd06923cc151ac26b"
COMMIT="0647fb31bdee8d0beee760961dcdb549e4a9c450"
SHA2="f4598904bcc585066c18eebadbd7dd5d23a80c8fda38fb2a9aa20c6499636d07"
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="a79cc46ce4a994ca245c8d52f157521c4c32399ae8b6e6dbb4b54126c7d6dc6b"
CIDL_SHA256_LINUX_DPD="98c79855d199e8c56b7c038641b4d5b3de9bfa9ac610b65a6116bd36f0702ecf"
CIDL_SHA256_LINUX_SWADM="cce690cba4bd585c0257bdc95cc257d04534c6b695d154341c9915cebd8124f9"
CIDL_SHA256_ILLUMOS="b06803d6d788f1b6ba4200548bb5f976dc043481837ecff20e6c1095235bbe82"
CIDL_SHA256_LINUX_DPD="b921d49daa9d644a0a01b92c11fd32edccf9104f0fa2e19b045b3d6ca002923e"
CIDL_SHA256_LINUX_SWADM="0f15487b3dc752d031670e4e94194a0c19952532d72c11a254ce49b608d2f57f"

0 comments on commit 7b361fa

Please sign in to comment.