Skip to content

Commit 803b9a4

Browse files
authored
[wicketd] Update bootstrap peer addrs after RSS config is uploaded (#3444)
When the user calls `GET /rack-setup/config`, we were filling in the bootstrap addresses of the _inventory_ (i.e., all available sleds), but we were not filling them in of the chosen sleds if the user had already uploaded a config. We now fill in both. Fixes #3440.
1 parent 03856c6 commit 803b9a4

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

wicketd/src/http_entrypoints.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ async fn get_rss_config(
212212
let inventory = inventory_or_unavail(&ctx.mgs_handle).await?;
213213

214214
let mut config = ctx.rss_config.lock().unwrap();
215-
config.populate_available_bootstrap_sleds_from_inventory(
215+
config.update_with_inventory_and_bootstrap_peers(
216216
&inventory,
217217
&ctx.bootstrap_peers,
218218
);
@@ -239,7 +239,7 @@ async fn put_rss_config(
239239
let inventory = inventory_or_unavail(&ctx.mgs_handle).await?;
240240

241241
let mut config = ctx.rss_config.lock().unwrap();
242-
config.populate_available_bootstrap_sleds_from_inventory(
242+
config.update_with_inventory_and_bootstrap_peers(
243243
&inventory,
244244
&ctx.bootstrap_peers,
245245
);

wicketd/src/rss_config.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ use omicron_common::address::Ipv4Range;
2727
use omicron_common::api::internal::shared::RackNetworkConfig;
2828
use sled_hardware::Baseboard;
2929
use std::collections::BTreeSet;
30+
use std::mem;
3031
use std::net::Ipv6Addr;
3132
use wicket_common::rack_setup::PutRssUserConfigInsensitive;
3233

@@ -68,7 +69,7 @@ pub(crate) struct CurrentRssConfig {
6869
}
6970

7071
impl CurrentRssConfig {
71-
pub(crate) fn populate_available_bootstrap_sleds_from_inventory(
72+
pub(crate) fn update_with_inventory_and_bootstrap_peers(
7273
&mut self,
7374
inventory: &RackV1Inventory,
7475
bootstrap_peers: &BootstrapPeers,
@@ -96,6 +97,18 @@ impl CurrentRssConfig {
9697
})
9798
})
9899
.collect();
100+
101+
// If the user has already uploaded a config specifying bootstrap_sleds,
102+
// also update our knowledge of those sleds' bootstrap addresses.
103+
let our_bootstrap_sleds = mem::take(&mut self.bootstrap_sleds);
104+
self.bootstrap_sleds = our_bootstrap_sleds
105+
.into_iter()
106+
.map(|mut sled_desc| {
107+
sled_desc.bootstrap_ip =
108+
bootstrap_sleds.get(&sled_desc.baseboard).copied();
109+
sled_desc
110+
})
111+
.collect();
99112
}
100113

101114
pub(crate) fn start_rss_request(

0 commit comments

Comments
 (0)