Skip to content

Commit d32777c

Browse files
authored
BlueprintSledConfig: add sled subnet (#9416)
Sled subnets are chosen when the sled is added to the cluster (either by RSS or by the "add sled" process), and do not change for the lifetime of the sled's membership. This PR adds that subnet to `BlueprintSledConfig`, removing one of the remaining bits where `BlueprintBuilder::new_based_on()` needs information other than the parent blueprint.
1 parent 01624e9 commit d32777c

39 files changed

+671
-187
lines changed

common/src/address.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
1010
use crate::api::external::{self, Error};
1111
use crate::policy::INTERNAL_DNS_REDUNDANCY;
12+
use daft::Diffable;
1213
use ipnetwork::Ipv6Network;
1314
use oxnet::{Ipv4Net, Ipv6Net};
1415
use schemars::JsonSchema;
@@ -289,12 +290,19 @@ pub const SLED_RESERVED_ADDRESSES: u16 = 32;
289290
Eq,
290291
PartialOrd,
291292
Ord,
293+
Diffable,
292294
)]
293295
#[schemars(rename = "Ipv6Subnet")]
294296
pub struct Ipv6Subnet<const N: u8> {
295297
net: Ipv6Net,
296298
}
297299

300+
impl<const N: u8> std::fmt::Display for Ipv6Subnet<N> {
301+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
302+
self.net.fmt(f)
303+
}
304+
}
305+
298306
impl<const N: u8> Ipv6Subnet<N> {
299307
pub fn new(addr: Ipv6Addr) -> Self {
300308
// Create a network with the compile-time prefix length.
@@ -318,6 +326,14 @@ impl<const N: u8> From<Ipv6Network> for Ipv6Subnet<N> {
318326
}
319327
}
320328

329+
impl<const N: u8> From<Ipv6Subnet<N>> for Ipv6Network {
330+
fn from(net: Ipv6Subnet<N>) -> Self {
331+
// Ipv6Subnet::new() asserts that `N` is a valid IPv6 prefix, so it's
332+
// okay to unwrap here.
333+
Self::new(net.net.prefix(), N).unwrap()
334+
}
335+
}
336+
321337
// We need a custom Deserialize to ensure that the subnet is what we expect.
322338
impl<'de, const N: u8> Deserialize<'de> for Ipv6Subnet<N> {
323339
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>

dev-tools/omdb/tests/successes.out

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1552,7 +1552,10 @@ stdout:
15521552
blueprint ......<REDACTED_BLUEPRINT_ID>.......
15531553
parent: <none>
15541554

1555-
sled: ..........<REDACTED_UUID>........... (active, config generation 2)
1555+
sled: ..........<REDACTED_UUID>...........
1556+
state::::::::::::: active
1557+
config generation: 2
1558+
subnet:::::::::::: ::/64
15561559

15571560
host phase 2 contents:
15581561
------------------------
@@ -1591,7 +1594,10 @@ parent: <none>
15911594

15921595

15931596

1594-
sled: ..........<REDACTED_UUID>........... (active, config generation 2)
1597+
sled: ..........<REDACTED_UUID>...........
1598+
state::::::::::::: active
1599+
config generation: 2
1600+
subnet:::::::::::: ::/64
15951601

15961602
host phase 2 contents:
15971603
------------------------
@@ -1676,7 +1682,10 @@ stdout:
16761682
blueprint ......<REDACTED_BLUEPRINT_ID>.......
16771683
parent: <none>
16781684

1679-
sled: ..........<REDACTED_UUID>........... (active, config generation 2)
1685+
sled: ..........<REDACTED_UUID>...........
1686+
state::::::::::::: active
1687+
config generation: 2
1688+
subnet:::::::::::: ::/64
16801689

16811690
host phase 2 contents:
16821691
------------------------
@@ -1715,7 +1724,10 @@ parent: <none>
17151724

17161725

17171726

1718-
sled: ..........<REDACTED_UUID>........... (active, config generation 2)
1727+
sled: ..........<REDACTED_UUID>...........
1728+
state::::::::::::: active
1729+
config generation: 2
1730+
subnet:::::::::::: ::/64
17191731

17201732
host phase 2 contents:
17211733
------------------------

dev-tools/reconfigurator-cli/tests/output/cmds-add-sled-no-disks-stdout

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ planning report:
5757
blueprint 8da82a8e-bf97-4fbd-8ddd-9f6462732cf1
5858
parent: dbcbd3d6-41ff-48ae-ac0b-1becc9b2fd21
5959

60-
sled: 00320471-945d-413c-85e7-03e091a70b3c (active, config generation 1)
60+
sled: 00320471-945d-413c-85e7-03e091a70b3c
61+
state::::::::::::: active
62+
config generation: 1
63+
subnet:::::::::::: fd00:1122:3344:104::/64
6164

6265
host phase 2 contents:
6366
------------------------
@@ -86,7 +89,10 @@ parent: dbcbd3d6-41ff-48ae-ac0b-1becc9b2fd21
8689

8790

8891

89-
sled: 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c (active, config generation 2)
92+
sled: 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c
93+
state::::::::::::: active
94+
config generation: 2
95+
subnet:::::::::::: fd00:1122:3344:102::/64
9096

9197
host phase 2 contents:
9298
------------------------
@@ -151,7 +157,10 @@ parent: dbcbd3d6-41ff-48ae-ac0b-1becc9b2fd21
151157

152158

153159

154-
sled: 98e6b7c2-2efa-41ca-b20a-0a4d61102fe6 (active, config generation 2)
160+
sled: 98e6b7c2-2efa-41ca-b20a-0a4d61102fe6
161+
state::::::::::::: active
162+
config generation: 2
163+
subnet:::::::::::: fd00:1122:3344:101::/64
155164

156165
host phase 2 contents:
157166
------------------------
@@ -213,7 +222,10 @@ parent: dbcbd3d6-41ff-48ae-ac0b-1becc9b2fd21
213222

214223

215224

216-
sled: d81c6a84-79b8-4958-ae41-ea46c9b19763 (active, config generation 2)
225+
sled: d81c6a84-79b8-4958-ae41-ea46c9b19763
226+
state::::::::::::: active
227+
config generation: 2
228+
subnet:::::::::::: fd00:1122:3344:103::/64
217229

218230
host phase 2 contents:
219231
------------------------

dev-tools/reconfigurator-cli/tests/output/cmds-example-stdout

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,10 @@ zpools (10):
8282
blueprint ade5749d-bdf3-4fab-a8ae-00bea01b3a5a
8383
parent: 02697f74-b14a-4418-90f0-c28b2a3a6aa9
8484

85-
sled: 2eb69596-f081-4e2d-9425-9994926e0832 (active, config generation 2)
85+
sled: 2eb69596-f081-4e2d-9425-9994926e0832
86+
state::::::::::::: active
87+
config generation: 2
88+
subnet:::::::::::: fd00:1122:3344:102::/64
8689

8790
host phase 2 contents:
8891
------------------------
@@ -196,7 +199,10 @@ parent: 02697f74-b14a-4418-90f0-c28b2a3a6aa9
196199

197200

198201

199-
sled: 32d8d836-4d8a-4e54-8fa9-f31d79c42646 (active, config generation 2)
202+
sled: 32d8d836-4d8a-4e54-8fa9-f31d79c42646
203+
state::::::::::::: active
204+
config generation: 2
205+
subnet:::::::::::: fd00:1122:3344:103::/64
200206

201207
host phase 2 contents:
202208
------------------------
@@ -307,7 +313,10 @@ parent: 02697f74-b14a-4418-90f0-c28b2a3a6aa9
307313

308314

309315

310-
sled: 89d02b1b-478c-401a-8e28-7a26f74fa41b (active, config generation 2)
316+
sled: 89d02b1b-478c-401a-8e28-7a26f74fa41b
317+
state::::::::::::: active
318+
config generation: 2
319+
subnet:::::::::::: fd00:1122:3344:101::/64
311320

312321
host phase 2 contents:
313322
------------------------
@@ -497,7 +506,10 @@ zpools (4):
497506
blueprint ade5749d-bdf3-4fab-a8ae-00bea01b3a5a
498507
parent: 02697f74-b14a-4418-90f0-c28b2a3a6aa9
499508

500-
sled: 89d02b1b-478c-401a-8e28-7a26f74fa41b (active, config generation 2)
509+
sled: 89d02b1b-478c-401a-8e28-7a26f74fa41b
510+
state::::::::::::: active
511+
config generation: 2
512+
subnet:::::::::::: fd00:1122:3344:101::/64
501513

502514
host phase 2 contents:
503515
------------------------
@@ -1151,7 +1163,10 @@ T ENA ID PARENT
11511163
blueprint ade5749d-bdf3-4fab-a8ae-00bea01b3a5a
11521164
parent: 02697f74-b14a-4418-90f0-c28b2a3a6aa9
11531165

1154-
sled: 2eb69596-f081-4e2d-9425-9994926e0832 (active, config generation 2)
1166+
sled: 2eb69596-f081-4e2d-9425-9994926e0832
1167+
state::::::::::::: active
1168+
config generation: 2
1169+
subnet:::::::::::: fd00:1122:3344:102::/64
11551170

11561171
host phase 2 contents:
11571172
------------------------
@@ -1203,7 +1218,10 @@ parent: 02697f74-b14a-4418-90f0-c28b2a3a6aa9
12031218

12041219

12051220

1206-
sled: 32d8d836-4d8a-4e54-8fa9-f31d79c42646 (active, config generation 2)
1221+
sled: 32d8d836-4d8a-4e54-8fa9-f31d79c42646
1222+
state::::::::::::: active
1223+
config generation: 2
1224+
subnet:::::::::::: fd00:1122:3344:103::/64
12071225

12081226
host phase 2 contents:
12091227
------------------------
@@ -1255,7 +1273,10 @@ parent: 02697f74-b14a-4418-90f0-c28b2a3a6aa9
12551273

12561274

12571275

1258-
sled: 89d02b1b-478c-401a-8e28-7a26f74fa41b (active, config generation 2)
1276+
sled: 89d02b1b-478c-401a-8e28-7a26f74fa41b
1277+
state::::::::::::: active
1278+
config generation: 2
1279+
subnet:::::::::::: fd00:1122:3344:101::/64
12591280

12601281
host phase 2 contents:
12611282
------------------------

dev-tools/reconfigurator-cli/tests/output/cmds-expunge-newly-added-external-dns-stdout

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ loaded example system with:
1111
blueprint 3f00b694-1b16-4aaa-8f78-e6b3a527b434
1212
parent: 06c88262-f435-410e-ba98-101bed41ec27
1313

14-
sled: 711ac7f8-d19e-4572-bdb9-e9b50f6e362a (active, config generation 2)
14+
sled: 711ac7f8-d19e-4572-bdb9-e9b50f6e362a
15+
state::::::::::::: active
16+
config generation: 2
17+
subnet:::::::::::: fd00:1122:3344:103::/64
1518

1619
host phase 2 contents:
1720
------------------------
@@ -125,7 +128,10 @@ parent: 06c88262-f435-410e-ba98-101bed41ec27
125128

126129

127130

128-
sled: 9dc50690-f9bf-4520-bf80-051d0f465c2c (active, config generation 2)
131+
sled: 9dc50690-f9bf-4520-bf80-051d0f465c2c
132+
state::::::::::::: active
133+
config generation: 2
134+
subnet:::::::::::: fd00:1122:3344:102::/64
129135

130136
host phase 2 contents:
131137
------------------------
@@ -236,7 +242,10 @@ parent: 06c88262-f435-410e-ba98-101bed41ec27
236242

237243

238244

239-
sled: a88790de-5962-4871-8686-61c1fd5b7094 (active, config generation 2)
245+
sled: a88790de-5962-4871-8686-61c1fd5b7094
246+
state::::::::::::: active
247+
config generation: 2
248+
subnet:::::::::::: fd00:1122:3344:101::/64
240249

241250
host phase 2 contents:
242251
------------------------
@@ -549,7 +558,10 @@ external DNS:
549558
blueprint 366b0b68-d80e-4bc1-abd3-dc69837847e0
550559
parent: 3f00b694-1b16-4aaa-8f78-e6b3a527b434
551560

552-
sled: 711ac7f8-d19e-4572-bdb9-e9b50f6e362a (active, config generation 3)
561+
sled: 711ac7f8-d19e-4572-bdb9-e9b50f6e362a
562+
state::::::::::::: active
563+
config generation: 3
564+
subnet:::::::::::: fd00:1122:3344:103::/64
553565

554566
host phase 2 contents:
555567
------------------------
@@ -663,7 +675,10 @@ parent: 3f00b694-1b16-4aaa-8f78-e6b3a527b434
663675

664676

665677

666-
sled: 9dc50690-f9bf-4520-bf80-051d0f465c2c (active, config generation 2)
678+
sled: 9dc50690-f9bf-4520-bf80-051d0f465c2c
679+
state::::::::::::: active
680+
config generation: 2
681+
subnet:::::::::::: fd00:1122:3344:102::/64
667682

668683
host phase 2 contents:
669684
------------------------
@@ -774,7 +789,10 @@ parent: 3f00b694-1b16-4aaa-8f78-e6b3a527b434
774789

775790

776791

777-
sled: a88790de-5962-4871-8686-61c1fd5b7094 (active, config generation 2)
792+
sled: a88790de-5962-4871-8686-61c1fd5b7094
793+
state::::::::::::: active
794+
config generation: 2
795+
subnet:::::::::::: fd00:1122:3344:101::/64
778796

779797
host phase 2 contents:
780798
------------------------
@@ -1112,7 +1130,10 @@ external DNS:
11121130
blueprint 9c998c1d-1a7b-440a-ae0c-40f781dea6e2
11131131
parent: 366b0b68-d80e-4bc1-abd3-dc69837847e0
11141132

1115-
sled: 711ac7f8-d19e-4572-bdb9-e9b50f6e362a (active, config generation 4)
1133+
sled: 711ac7f8-d19e-4572-bdb9-e9b50f6e362a
1134+
state::::::::::::: active
1135+
config generation: 4
1136+
subnet:::::::::::: fd00:1122:3344:103::/64
11161137

11171138
host phase 2 contents:
11181139
------------------------
@@ -1229,7 +1250,10 @@ parent: 366b0b68-d80e-4bc1-abd3-dc69837847e0
12291250

12301251

12311252

1232-
sled: 9dc50690-f9bf-4520-bf80-051d0f465c2c (active, config generation 2)
1253+
sled: 9dc50690-f9bf-4520-bf80-051d0f465c2c
1254+
state::::::::::::: active
1255+
config generation: 2
1256+
subnet:::::::::::: fd00:1122:3344:102::/64
12331257

12341258
host phase 2 contents:
12351259
------------------------
@@ -1340,7 +1364,10 @@ parent: 366b0b68-d80e-4bc1-abd3-dc69837847e0
13401364

13411365

13421366

1343-
sled: a88790de-5962-4871-8686-61c1fd5b7094 (active, config generation 2)
1367+
sled: a88790de-5962-4871-8686-61c1fd5b7094
1368+
state::::::::::::: active
1369+
config generation: 2
1370+
subnet:::::::::::: fd00:1122:3344:101::/64
13441371

13451372
host phase 2 contents:
13461373
------------------------

dev-tools/reconfigurator-cli/tests/output/cmds-expunge-newly-added-internal-dns-stdout

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ loaded example system with:
99
blueprint dbcbd3d6-41ff-48ae-ac0b-1becc9b2fd21
1010
parent: 184f10b3-61cb-41ef-9b93-3489b2bac559
1111

12-
sled: 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c (active, config generation 2)
12+
sled: 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c
13+
state::::::::::::: active
14+
config generation: 2
15+
subnet:::::::::::: fd00:1122:3344:102::/64
1316

1417
host phase 2 contents:
1518
------------------------
@@ -123,7 +126,10 @@ parent: 184f10b3-61cb-41ef-9b93-3489b2bac559
123126

124127

125128

126-
sled: 98e6b7c2-2efa-41ca-b20a-0a4d61102fe6 (active, config generation 2)
129+
sled: 98e6b7c2-2efa-41ca-b20a-0a4d61102fe6
130+
state::::::::::::: active
131+
config generation: 2
132+
subnet:::::::::::: fd00:1122:3344:101::/64
127133

128134
host phase 2 contents:
129135
------------------------
@@ -234,7 +240,10 @@ parent: 184f10b3-61cb-41ef-9b93-3489b2bac559
234240

235241

236242

237-
sled: d81c6a84-79b8-4958-ae41-ea46c9b19763 (active, config generation 2)
243+
sled: d81c6a84-79b8-4958-ae41-ea46c9b19763
244+
state::::::::::::: active
245+
config generation: 2
246+
subnet:::::::::::: fd00:1122:3344:103::/64
238247

239248
host phase 2 contents:
240249
------------------------

0 commit comments

Comments
 (0)