Skip to content

Commit f3de50c

Browse files
committed
add reconfigurator-cli command for bumping Nexus generation
1 parent f01ffe9 commit f3de50c

File tree

6 files changed

+231
-1
lines changed

6 files changed

+231
-1
lines changed

dev-tools/reconfigurator-cli/src/lib.rs

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
//! developer REPL for driving blueprint planning
66
7-
use anyhow::{Context, anyhow, bail};
7+
use anyhow::{Context, anyhow, bail, ensure};
88
use camino::{Utf8Path, Utf8PathBuf};
99
use chrono::{DateTime, Utc};
1010
use clap::{ArgAction, ValueEnum};
@@ -784,6 +784,11 @@ enum BlueprintEditCommands {
784784
#[command(subcommand)]
785785
command: BlueprintEditDebugCommands,
786786
},
787+
/// bumps the blueprint's Nexus generation
788+
///
789+
/// This initiates a handoff from the current generation of Nexus zones to
790+
/// the next generation of Nexus zones.
791+
BumpNexusGeneration,
787792
}
788793

789794
#[derive(Debug, Subcommand)]
@@ -2161,6 +2166,29 @@ fn cmd_blueprint_edit(
21612166
.context("failed to add CockroachDB zone")?;
21622167
format!("added CockroachDB zone to sled {}", sled_id)
21632168
}
2169+
BlueprintEditCommands::BumpNexusGeneration => {
2170+
let current_generation = builder.nexus_generation();
2171+
let current_max = blueprint
2172+
.all_nexus_zones(BlueprintZoneDisposition::is_in_service)
2173+
.fold(
2174+
current_generation,
2175+
|current_max, (_sled_id, _zone_config, nexus_config)| {
2176+
std::cmp::max(
2177+
nexus_config.nexus_generation,
2178+
current_max,
2179+
)
2180+
},
2181+
);
2182+
ensure!(
2183+
current_max > current_generation,
2184+
"cannot bump blueprint generation (currently \
2185+
{current_generation}) past highest deployed Nexus \
2186+
generation (currently {current_max})",
2187+
);
2188+
let next = current_generation.next();
2189+
builder.set_nexus_generation(next);
2190+
format!("nexus generation: {current_generation} -> {next}")
2191+
}
21642192
BlueprintEditCommands::SetRemoveMupdateOverride { sled_id, value } => {
21652193
let sled_id = sled_id.to_sled_id(system.description())?;
21662194
builder
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Load example system
2+
load-example --nsleds 3 --ndisks-per-sled 3
3+
4+
# Print the initial configuration
5+
show
6+
sled-list
7+
8+
# Try to bump the Nexus generation. This should not work because you can't
9+
# bump it to a generation that has no Nexus instances deployed.
10+
blueprint-edit dbcbd3d6-41ff-48ae-ac0b-1becc9b2fd21 bump-nexus-generation
11+
12+
# Now, deploy a Nexus instance at the next generation.
13+
blueprint-edit dbcbd3d6-41ff-48ae-ac0b-1becc9b2fd21 add-nexus serial0 2
14+
blueprint-diff 8da82a8e-bf97-4fbd-8ddd-9f6462732cf1
15+
16+
# Now we can bump the Nexus generation to trigger a handoff.
17+
blueprint-edit 8da82a8e-bf97-4fbd-8ddd-9f6462732cf1 bump-nexus-generation
18+
blueprint-diff 58d5e830-0884-47d8-a7cd-b2b3751adeb4

dev-tools/reconfigurator-cli/tests/output/cmds-nexus-generation-stderr

Whitespace-only changes.
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
using provided RNG seed: reconfigurator-cli-test
2+
> # Load example system
3+
> load-example --nsleds 3 --ndisks-per-sled 3
4+
loaded example system with:
5+
- collection: f45ba181-4b56-42cc-a762-874d90184a43
6+
- blueprint: dbcbd3d6-41ff-48ae-ac0b-1becc9b2fd21
7+
8+
9+
> # Print the initial configuration
10+
> show
11+
configured external DNS zone name: oxide.example
12+
configured silo names: example-silo
13+
internal DNS generations: 1
14+
external DNS generations: 1
15+
target number of Nexus instances: default
16+
target release (generation 1): unset
17+
planner config:
18+
add zones with mupdate override: false
19+
20+
21+
> sled-list
22+
ID SERIAL NZPOOLS SUBNET
23+
2b8f0cb3-0295-4b3c-bc58-4fe88b57112c serial1 3 fd00:1122:3344:102::/64
24+
98e6b7c2-2efa-41ca-b20a-0a4d61102fe6 serial0 3 fd00:1122:3344:101::/64
25+
d81c6a84-79b8-4958-ae41-ea46c9b19763 serial2 3 fd00:1122:3344:103::/64
26+
27+
28+
> # Try to bump the Nexus generation. This should not work because you can't
29+
> # bump it to a generation that has no Nexus instances deployed.
30+
> blueprint-edit dbcbd3d6-41ff-48ae-ac0b-1becc9b2fd21 bump-nexus-generation
31+
error: cannot bump blueprint generation (currently 1) past highest deployed Nexus generation (currently 1)
32+
33+
34+
> # Now, deploy a Nexus instance at the next generation.
35+
> blueprint-edit dbcbd3d6-41ff-48ae-ac0b-1becc9b2fd21 add-nexus serial0 2
36+
blueprint 8da82a8e-bf97-4fbd-8ddd-9f6462732cf1 created from blueprint dbcbd3d6-41ff-48ae-ac0b-1becc9b2fd21: added Nexus zone to sled 98e6b7c2-2efa-41ca-b20a-0a4d61102fe6
37+
38+
> blueprint-diff 8da82a8e-bf97-4fbd-8ddd-9f6462732cf1
39+
from: blueprint dbcbd3d6-41ff-48ae-ac0b-1becc9b2fd21
40+
to: blueprint 8da82a8e-bf97-4fbd-8ddd-9f6462732cf1
41+
42+
MODIFIED SLEDS:
43+
44+
sled 98e6b7c2-2efa-41ca-b20a-0a4d61102fe6 (active, config generation 2 -> 3):
45+
46+
host phase 2 contents:
47+
------------------------
48+
slot boot image source
49+
------------------------
50+
A current contents
51+
B current contents
52+
53+
54+
physical disks:
55+
------------------------------------------------------------------------------------
56+
vendor model serial disposition
57+
------------------------------------------------------------------------------------
58+
fake-vendor fake-model serial-073979dd-3248-44a5-9fa1-cc72a140d682 in service
59+
fake-vendor fake-model serial-c6d33b64-fb96-4129-bab1-7878a06a5f9b in service
60+
fake-vendor fake-model serial-e4d937e1-6ddc-4eca-bb08-c1f73791e608 in service
61+
62+
63+
datasets:
64+
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
65+
dataset name dataset id disposition quota reservation compression
66+
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
67+
oxp_073979dd-3248-44a5-9fa1-cc72a140d682/crucible 7b4ce6bf-95bb-42fe-a4a0-dff31211ab88 in service none none off
68+
oxp_c6d33b64-fb96-4129-bab1-7878a06a5f9b/crucible ea8a11bf-a884-4c4f-8df0-3ef9b7aacf43 in service none none off
69+
oxp_e4d937e1-6ddc-4eca-bb08-c1f73791e608/crucible 50b029e3-96aa-41e5-bf39-023193a4355e in service none none off
70+
oxp_073979dd-3248-44a5-9fa1-cc72a140d682/crypt/external_dns 4847a96e-a267-4ae7-aa3d-805c1e77f81e in service none none off
71+
oxp_073979dd-3248-44a5-9fa1-cc72a140d682/crypt/internal_dns ad41be71-6c15-4428-b510-20ceacde4fa6 in service none none off
72+
oxp_073979dd-3248-44a5-9fa1-cc72a140d682/crypt/zone 4617d206-4330-4dfa-b9f3-f63a3db834f9 in service none none off
73+
oxp_c6d33b64-fb96-4129-bab1-7878a06a5f9b/crypt/zone 793ac181-1b01-403c-850d-7f5c54bda6c9 in service none none off
74+
oxp_e4d937e1-6ddc-4eca-bb08-c1f73791e608/crypt/zone 4f60b534-eaa3-40a1-b60f-bfdf147af478 in service none none off
75+
oxp_e4d937e1-6ddc-4eca-bb08-c1f73791e608/crypt/zone/oxz_crucible_058fd5f9-60a8-4e11-9302-15172782e17d 02c56a30-7d97-406d-bd34-1eb437fd517d in service none none off
76+
oxp_073979dd-3248-44a5-9fa1-cc72a140d682/crypt/zone/oxz_crucible_5199c033-4cf9-4ab6-8ae7-566bd7606363 832fd140-d467-4bad-b5e9-63171634087c in service none none off
77+
oxp_c6d33b64-fb96-4129-bab1-7878a06a5f9b/crypt/zone/oxz_crucible_dfac80b4-a887-430a-ae87-a4e065dba787 4d7e3e8e-06bd-414c-a468-779e056a9b75 in service none none off
78+
oxp_073979dd-3248-44a5-9fa1-cc72a140d682/crypt/zone/oxz_crucible_pantry_ba4994a8-23f9-4b1a-a84f-a08d74591389 42430c80-7836-4191-a4f6-bcee749010fe in service none none off
79+
oxp_073979dd-3248-44a5-9fa1-cc72a140d682/crypt/zone/oxz_external_dns_803bfb63-c246-41db-b0da-d3b87ddfc63d 43931274-7fe8-4077-825d-dff2bc8efa58 in service none none off
80+
oxp_073979dd-3248-44a5-9fa1-cc72a140d682/crypt/zone/oxz_internal_dns_427ec88f-f467-42fa-9bbb-66a91a36103c 1bca7f71-5e42-4749-91ec-fa40793a3a9a in service none none off
81+
oxp_073979dd-3248-44a5-9fa1-cc72a140d682/crypt/zone/oxz_nexus_0c71b3b2-6ceb-4e8f-b020-b08675e83038 a4c3032e-21fa-4d4a-b040-a7e3c572cf3c in service none none off
82+
oxp_073979dd-3248-44a5-9fa1-cc72a140d682/crypt/zone/oxz_ntp_6444f8a5-6465-4f0b-a549-1993c113569c 3ac089c9-9dec-465b-863a-188e80d71fb4 in service none none off
83+
oxp_073979dd-3248-44a5-9fa1-cc72a140d682/crypt/debug 248c6c10-1ac6-45de-bb55-ede36ca56bbd in service 100 GiB none gzip-9
84+
oxp_c6d33b64-fb96-4129-bab1-7878a06a5f9b/crypt/debug cdf3684f-a6cf-4449-b9ec-e696b2c663e2 in service 100 GiB none gzip-9
85+
oxp_e4d937e1-6ddc-4eca-bb08-c1f73791e608/crypt/debug 686c19cf-a0d7-45f6-866f-c564612b2664 in service 100 GiB none gzip-9
86+
+ oxp_c6d33b64-fb96-4129-bab1-7878a06a5f9b/crypt/zone/oxz_nexus_16a766ee-9400-4e67-9363-883670371a1b 5205257b-48e5-4fb8-827a-9a7b29f43dbe in service none none off
87+
88+
89+
omicron zones:
90+
---------------------------------------------------------------------------------------------------------------
91+
zone type zone id image source disposition underlay IP
92+
---------------------------------------------------------------------------------------------------------------
93+
crucible 058fd5f9-60a8-4e11-9302-15172782e17d install dataset in service fd00:1122:3344:101::27
94+
crucible 5199c033-4cf9-4ab6-8ae7-566bd7606363 install dataset in service fd00:1122:3344:101::25
95+
crucible dfac80b4-a887-430a-ae87-a4e065dba787 install dataset in service fd00:1122:3344:101::26
96+
crucible_pantry ba4994a8-23f9-4b1a-a84f-a08d74591389 install dataset in service fd00:1122:3344:101::24
97+
external_dns 803bfb63-c246-41db-b0da-d3b87ddfc63d install dataset in service fd00:1122:3344:101::23
98+
internal_dns 427ec88f-f467-42fa-9bbb-66a91a36103c install dataset in service fd00:1122:3344:2::1
99+
internal_ntp 6444f8a5-6465-4f0b-a549-1993c113569c install dataset in service fd00:1122:3344:101::21
100+
nexus 0c71b3b2-6ceb-4e8f-b020-b08675e83038 install dataset in service fd00:1122:3344:101::22
101+
+ nexus 16a766ee-9400-4e67-9363-883670371a1b install dataset in service fd00:1122:3344:101::28
102+
103+
104+
COCKROACHDB SETTINGS:
105+
state fingerprint::::::::::::::::: (none) (unchanged)
106+
cluster.preserve_downgrade_option: (do not modify) (unchanged)
107+
108+
METADATA:
109+
internal DNS version::: 1 (unchanged)
110+
external DNS version::: 1 (unchanged)
111+
target release min gen: 1 (unchanged)
112+
nexus gen:::::::::::::: 1 (unchanged)
113+
114+
OXIMETER SETTINGS:
115+
generation: 1 (unchanged)
116+
read from:: SingleNode (unchanged)
117+
118+
119+
internal DNS:
120+
* DNS zone: "control-plane.oxide.internal":
121+
+ name: 16a766ee-9400-4e67-9363-883670371a1b.host (records: 1)
122+
+ AAAA fd00:1122:3344:101::28
123+
* name: _nexus._tcp (records: 3 -> 4)
124+
- SRV port 12221 0c71b3b2-6ceb-4e8f-b020-b08675e83038.host.control-plane.oxide.internal
125+
- SRV port 12221 3eeb8d49-eb1a-43f8-bb64-c2338421c2c6.host.control-plane.oxide.internal
126+
- SRV port 12221 466a9f29-62bf-4e63-924a-b9efdb86afec.host.control-plane.oxide.internal
127+
+ SRV port 12221 0c71b3b2-6ceb-4e8f-b020-b08675e83038.host.control-plane.oxide.internal
128+
+ SRV port 12221 16a766ee-9400-4e67-9363-883670371a1b.host.control-plane.oxide.internal
129+
+ SRV port 12221 3eeb8d49-eb1a-43f8-bb64-c2338421c2c6.host.control-plane.oxide.internal
130+
+ SRV port 12221 466a9f29-62bf-4e63-924a-b9efdb86afec.host.control-plane.oxide.internal
131+
unchanged names: 50 (records: 62)
132+
133+
external DNS:
134+
* DNS zone: "oxide.example":
135+
* name: example-silo.sys (records: 3 -> 4)
136+
- A 192.0.2.2
137+
- A 192.0.2.3
138+
- A 192.0.2.4
139+
+ A 192.0.2.2
140+
+ A 192.0.2.3
141+
+ A 192.0.2.5
142+
+ A 192.0.2.4
143+
unchanged names: 4 (records: 6)
144+
145+
146+
147+
148+
> # Now we can bump the Nexus generation to trigger a handoff.
149+
> blueprint-edit 8da82a8e-bf97-4fbd-8ddd-9f6462732cf1 bump-nexus-generation
150+
blueprint 58d5e830-0884-47d8-a7cd-b2b3751adeb4 created from blueprint 8da82a8e-bf97-4fbd-8ddd-9f6462732cf1: nexus generation: 1 -> 2
151+
152+
> blueprint-diff 58d5e830-0884-47d8-a7cd-b2b3751adeb4
153+
from: blueprint 8da82a8e-bf97-4fbd-8ddd-9f6462732cf1
154+
to: blueprint 58d5e830-0884-47d8-a7cd-b2b3751adeb4
155+
156+
COCKROACHDB SETTINGS:
157+
state fingerprint::::::::::::::::: (none) (unchanged)
158+
cluster.preserve_downgrade_option: (do not modify) (unchanged)
159+
160+
METADATA:
161+
internal DNS version::: 1 (unchanged)
162+
external DNS version::: 1 (unchanged)
163+
target release min gen: 1 (unchanged)
164+
* nexus gen:::::::::::::: 1 -> 2
165+
166+
OXIMETER SETTINGS:
167+
generation: 1 (unchanged)
168+
read from:: SingleNode (unchanged)
169+
170+
171+
internal DNS:
172+
DNS zone: "control-plane.oxide.internal" (unchanged)
173+
unchanged names: 52 (records: 67)
174+
175+
external DNS:
176+
DNS zone: "oxide.example" (unchanged)
177+
unchanged names: 5 (records: 10)
178+
179+
180+

dev-tools/reconfigurator-cli/tests/output/cmds-set-mgs-updates-stdout

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,6 +1347,8 @@ Commands:
13471347
delete a configured SP update
13481348
debug
13491349
debug commands that bypass normal checks
1350+
bump-nexus-generation
1351+
bumps the blueprint's Nexus generation
13501352
help
13511353
Print this message or the help of the given subcommand(s)
13521354

dev-tools/reconfigurator-cli/tests/output/cmds-set-zone-images-stdout

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,8 @@ Commands:
611611
delete a configured SP update
612612
debug
613613
debug commands that bypass normal checks
614+
bump-nexus-generation
615+
bumps the blueprint's Nexus generation
614616
help
615617
Print this message or the help of the given subcommand(s)
616618

0 commit comments

Comments
 (0)