Skip to content

Commit

Permalink
sled-agent: Configure mgd and mg-ddm even if we don't have rack/sled …
Browse files Browse the repository at this point in the history
…IDs yet (#5323)
  • Loading branch information
jgallagher authored Mar 27, 2024
1 parent 4ed3933 commit cf185c5
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 32 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ maplit = "1.0.2"
mime_guess = "2.0.4"
mockall = "0.12"
newtype_derive = "0.1.6"
mg-admin-client = { git = "https://github.com/oxidecomputer/maghemite", rev = "de065a84831e66c829603d9a098e237e8f5faaa1" }
ddm-admin-client = { git = "https://github.com/oxidecomputer/maghemite", rev = "de065a84831e66c829603d9a098e237e8f5faaa1" }
mg-admin-client = { git = "https://github.com/oxidecomputer/maghemite", rev = "8207cb9c90cd7144c3f351823bfb2ae3e221ad10" }
ddm-admin-client = { git = "https://github.com/oxidecomputer/maghemite", rev = "8207cb9c90cd7144c3f351823bfb2ae3e221ad10" }
multimap = "0.10.0"
nexus-client = { path = "clients/nexus-client" }
nexus-config = { path = "nexus-config" }
Expand Down
12 changes: 6 additions & 6 deletions package-manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -535,10 +535,10 @@ source.repo = "maghemite"
# `tools/maghemite_openapi_version`. Failing to do so will cause a failure when
# building `ddm-admin-client` (which will instruct you to update
# `tools/maghemite_openapi_version`).
source.commit = "de065a84831e66c829603d9a098e237e8f5faaa1"
source.commit = "8207cb9c90cd7144c3f351823bfb2ae3e221ad10"
# The SHA256 digest is automatically posted to:
# https://buildomat.eng.oxide.computer/public/file/oxidecomputer/maghemite/image/<commit>/maghemite.sha256.txt
source.sha256 = "8a7525f8329c5178ebf07cecc623a017806b81d5d1ca55cf76b88e737ae57dec"
source.sha256 = "dc58a0b4b1fe739e535e881e5e0678067fb8661e61cb837841224dd14608d54c"
output.type = "tarball"

[package.mg-ddm]
Expand All @@ -551,10 +551,10 @@ source.repo = "maghemite"
# `tools/maghemite_openapi_version`. Failing to do so will cause a failure when
# building `ddm-admin-client` (which will instruct you to update
# `tools/maghemite_openapi_version`).
source.commit = "de065a84831e66c829603d9a098e237e8f5faaa1"
source.commit = "8207cb9c90cd7144c3f351823bfb2ae3e221ad10"
# The SHA256 digest is automatically posted to:
# https://buildomat.eng.oxide.computer/public/file/oxidecomputer/maghemite/image/<commit>/mg-ddm.sha256.txt
source.sha256 = "0cc9cbef39103d3e651334574ebdd0e6ef71670cbe6a720d22b1efb005b5a71c"
source.sha256 = "4221a80d6ffb16b0f4d8b67a198a3da517154c3e7d8c1f0eaebb4eda6c36bdeb"
output.type = "zone"
output.intermediate_only = true

Expand All @@ -566,10 +566,10 @@ source.repo = "maghemite"
# `tools/maghemite_openapi_version`. Failing to do so will cause a failure when
# building `ddm-admin-client` (which will instruct you to update
# `tools/maghemite_openapi_version`).
source.commit = "de065a84831e66c829603d9a098e237e8f5faaa1"
source.commit = "8207cb9c90cd7144c3f351823bfb2ae3e221ad10"
# The SHA256 digest is automatically posted to:
# https://buildomat.eng.oxide.computer/public/file/oxidecomputer/maghemite/image/<commit>/mg-ddm.sha256.txt
source.sha256 = "4256d320b1ec310d56679eca5f65c9149072fe647f66021fd0cce1411fc39e0c"
source.sha256 = "ee3ef45706641784a8cfb093310bf5603755b59714db92bce058bb7cc1483099"
output.type = "zone"
output.intermediate_only = true

Expand Down
89 changes: 68 additions & 21 deletions sled-agent/src/services.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2755,16 +2755,13 @@ impl ServiceManager {
SwitchService::Mgd => {
info!(self.inner.log, "Setting up mgd service");
smfh.delpropvalue("config/dns_servers", "*")?;
let info = self
.inner
.sled_info
.get()
.ok_or(Error::SledAgentNotReady)?;
smfh.setprop("config/rack_uuid", info.rack_id)?;
smfh.setprop(
"config/sled_uuid",
info.config.sled_id,
)?;
if let Some(info) = self.inner.sled_info.get() {
smfh.setprop("config/rack_uuid", info.rack_id)?;
smfh.setprop(
"config/sled_uuid",
info.config.sled_id,
)?;
}
for address in &request.zone.addresses {
if *address != Ipv6Addr::LOCALHOST {
let az_prefix =
Expand All @@ -2785,16 +2782,13 @@ impl ServiceManager {
SwitchService::MgDdm { mode } => {
info!(self.inner.log, "Setting up mg-ddm service");
smfh.setprop("config/mode", &mode)?;
let info = self
.inner
.sled_info
.get()
.ok_or(Error::SledAgentNotReady)?;
smfh.setprop("config/rack_uuid", info.rack_id)?;
smfh.setprop(
"config/sled_uuid",
info.config.sled_id,
)?;
if let Some(info) = self.inner.sled_info.get() {
smfh.setprop("config/rack_uuid", info.rack_id)?;
smfh.setprop(
"config/sled_uuid",
info.config.sled_id,
)?;
}
smfh.delpropvalue("config/dns_servers", "*")?;
for address in &request.zone.addresses {
if *address != Ipv6Addr::LOCALHOST {
Expand Down Expand Up @@ -3993,12 +3987,65 @@ impl ServiceManager {
// Only configured in
// `ensure_switch_zone_uplinks_configured`
}
SwitchService::SpSim => {
// nothing to configure
}
SwitchService::Mgd => {
info!(self.inner.log, "configuring mgd service");
smfh.delpropvalue("config/dns_servers", "*")?;
if let Some(info) = self.inner.sled_info.get() {
smfh.setprop("config/rack_uuid", info.rack_id)?;
smfh.setprop(
"config/sled_uuid",
info.config.sled_id,
)?;
}
for address in &request.addresses {
if *address != Ipv6Addr::LOCALHOST {
let az_prefix =
Ipv6Subnet::<AZ_PREFIX>::new(*address);
for addr in
Resolver::servers_from_subnet(az_prefix)
{
smfh.addpropvalue(
"config/dns_servers",
&format!("{addr}"),
)?;
}
break;
}
}
smfh.refresh()?;
}
SwitchService::MgDdm { mode } => {
info!(self.inner.log, "configuring mg-ddm service");
smfh.delpropvalue("config/mode", "*")?;
smfh.addpropvalue("config/mode", &mode)?;
if let Some(info) = self.inner.sled_info.get() {
smfh.setprop("config/rack_uuid", info.rack_id)?;
smfh.setprop(
"config/sled_uuid",
info.config.sled_id,
)?;
}
smfh.delpropvalue("config/dns_servers", "*")?;
for address in &request.addresses {
if *address != Ipv6Addr::LOCALHOST {
let az_prefix =
Ipv6Subnet::<AZ_PREFIX>::new(*address);
for addr in
Resolver::servers_from_subnet(az_prefix)
{
smfh.addpropvalue(
"config/dns_servers",
&format!("{addr}"),
)?;
}
break;
}
}
smfh.refresh()?;
}
_ => (),
}
}
}
Expand Down

0 comments on commit cf185c5

Please sign in to comment.