From 7b361fa33b111f9ddc58209f13ce80ce21efece9 Mon Sep 17 00:00:00 2001 From: Zeeshan Lakhani Date: Fri, 1 Nov 2024 15:23:01 +0000 Subject: [PATCH] services cleanup and dendrite update --- package-manifest.toml | 12 +- sled-agent/src/services.rs | 207 ++++++++++++--------------------- tools/dendrite_openapi_version | 4 +- tools/dendrite_stub_checksums | 6 +- 4 files changed, 84 insertions(+), 145 deletions(-) diff --git a/package-manifest.toml b/package-manifest.toml index c711b1d328b..ff30615eaf2 100644 --- a/package-manifest.toml +++ b/package-manifest.toml @@ -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 @@ -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 @@ -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 diff --git a/sled-agent/src/services.rs b/sled-agent/src/services.rs index b3871a6c623..129df944dd7 100644 --- a/sled-agent/src/services.rs +++ b/sled-agent/src/services.rs @@ -377,6 +377,63 @@ fn display_zone_init_errors(errors: &[(String, Box)]) -> 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 @@ -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( @@ -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), ); @@ -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, @@ -4555,32 +4519,7 @@ 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, @@ -4588,12 +4527,12 @@ impl ServiceManager { ); } 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", )?; diff --git a/tools/dendrite_openapi_version b/tools/dendrite_openapi_version index b63386197ec..cdfaa2c7ab1 100755 --- a/tools/dendrite_openapi_version +++ b/tools/dendrite_openapi_version @@ -1,2 +1,2 @@ -COMMIT="a502a30b43b32ad4c884ab4e1e6d87bc01387166" -SHA2="b1bcf5ad3c2ce556d861367aa2942340a7ccfe592c83e96dd06923cc151ac26b" +COMMIT="0647fb31bdee8d0beee760961dcdb549e4a9c450" +SHA2="f4598904bcc585066c18eebadbd7dd5d23a80c8fda38fb2a9aa20c6499636d07" diff --git a/tools/dendrite_stub_checksums b/tools/dendrite_stub_checksums index b3edb50bd81..99b318c434d 100644 --- a/tools/dendrite_stub_checksums +++ b/tools/dendrite_stub_checksums @@ -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"