Skip to content

Commit fc12607

Browse files
authored
Planning reports (#8631)
Fixes #8284, fixes #8548. Replaces many (but not yet all) planner log messages with entries in a structured planning report. Those reports are comprised of "step reports", each of which corresponds to a subroutine of `do_plan`. The complete report may be formatted (in English) via a `Display` implementation. If planning from the `blueprint_planner` background task is successful, a report is attached to the `BlueprintPlannerStatus::Targeted` variant so that it may be displayed via `omdb`.
1 parent fc59b74 commit fc12607

38 files changed

+2744
-716
lines changed

dev-tools/omdb/src/bin/omdb/nexus.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1268,11 +1268,12 @@ fn print_task_blueprint_planner(details: &serde_json::Value) {
12681268
but could not make it the target: {error}"
12691269
);
12701270
}
1271-
BlueprintPlannerStatus::Targeted { blueprint_id, .. } => {
1271+
BlueprintPlannerStatus::Targeted { blueprint_id, report, .. } => {
12721272
println!(
12731273
" planned new blueprint {blueprint_id}, \
12741274
and made it the current target"
12751275
);
1276+
println!("{report}");
12761277
}
12771278
}
12781279
}

dev-tools/omdb/tests/successes.out

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1615,6 +1615,9 @@ parent: <none>
16151615

16161616
PENDING MGS-MANAGED UPDATES: 0
16171617

1618+
empty planning report for blueprint ......<REDACTED_BLUEPRINT_ID>........
1619+
1620+
16181621
---------------------------------------------
16191622
stderr:
16201623
note: using Nexus URL http://127.0.0.1:REDACTED_PORT/
@@ -1735,6 +1738,9 @@ parent: <none>
17351738

17361739
PENDING MGS-MANAGED UPDATES: 0
17371740

1741+
empty planning report for blueprint ......<REDACTED_BLUEPRINT_ID>........
1742+
1743+
17381744
---------------------------------------------
17391745
stderr:
17401746
note: using Nexus URL http://127.0.0.1:REDACTED_PORT/

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1861,14 +1861,14 @@ fn cmd_blueprint_plan(
18611861
&planning_input,
18621862
creator,
18631863
collection,
1864+
rng,
18641865
)
1865-
.context("creating planner")?
1866-
.with_rng(rng);
1866+
.context("creating planner")?;
18671867

18681868
let blueprint = planner.plan().context("generating blueprint")?;
18691869
let rv = format!(
1870-
"generated blueprint {} based on parent blueprint {}",
1871-
blueprint.id, parent_blueprint.id,
1870+
"generated blueprint {} based on parent blueprint {}\n{}",
1871+
blueprint.id, parent_blueprint.id, blueprint.report,
18721872
);
18731873
system.add_blueprint(blueprint)?;
18741874

@@ -1906,9 +1906,9 @@ fn cmd_blueprint_edit(
19061906
&planning_input,
19071907
&latest_collection,
19081908
creator,
1909+
rng,
19091910
)
19101911
.context("creating blueprint builder")?;
1911-
builder.set_rng(rng);
19121912

19131913
if let Some(comment) = args.comment {
19141914
builder.comment(comment);

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

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,15 @@ generated inventory collection eb0796d5-ab8a-4f7b-a884-b4aeacb8ab51 from configu
3737
> # we added has no disks.
3838
> blueprint-plan dbcbd3d6-41ff-48ae-ac0b-1becc9b2fd21 eb0796d5-ab8a-4f7b-a884-b4aeacb8ab51
3939
INFO skipping noop image source check for all sleds, reason: no target release is currently set
40-
INFO skipping sled (no zpools in service), sled_id: 00320471-945d-413c-85e7-03e091a70b3c
41-
INFO sufficient BoundaryNtp zones exist in plan, desired_count: 0, current_count: 0
42-
INFO sufficient Clickhouse zones exist in plan, desired_count: 1, current_count: 1
43-
INFO sufficient ClickhouseKeeper zones exist in plan, desired_count: 0, current_count: 0
44-
INFO sufficient ClickhouseServer zones exist in plan, desired_count: 0, current_count: 0
45-
INFO sufficient CockroachDb zones exist in plan, desired_count: 0, current_count: 0
46-
INFO sufficient CruciblePantry zones exist in plan, desired_count: 3, current_count: 3
47-
INFO sufficient InternalDns zones exist in plan, desired_count: 3, current_count: 3
48-
INFO sufficient ExternalDns zones exist in plan, desired_count: 3, current_count: 3
49-
INFO sufficient Nexus zones exist in plan, desired_count: 3, current_count: 3
50-
INFO sufficient Oximeter zones exist in plan, desired_count: 0, current_count: 0
5140
WARN cannot issue more MGS-driven updates (no current artifacts)
52-
INFO all zones up-to-date
53-
INFO will ensure cockroachdb setting, setting: cluster.preserve_downgrade_option, value: DoNotModify
5441
generated blueprint 8da82a8e-bf97-4fbd-8ddd-9f6462732cf1 based on parent blueprint dbcbd3d6-41ff-48ae-ac0b-1becc9b2fd21
42+
planning report for blueprint 8da82a8e-bf97-4fbd-8ddd-9f6462732cf1:
43+
chicken switches:
44+
add zones with mupdate override: false
45+
46+
* no zpools in service for NTP zones on sleds: 00320471-945d-413c-85e7-03e091a70b3c
47+
* discretionary zone placement waiting for NTP zones on sleds: 00320471-945d-413c-85e7-03e091a70b3c
48+
5549

5650
> blueprint-show 8da82a8e-bf97-4fbd-8ddd-9f6462732cf1
5751
blueprint 8da82a8e-bf97-4fbd-8ddd-9f6462732cf1
@@ -283,4 +277,12 @@ parent: dbcbd3d6-41ff-48ae-ac0b-1becc9b2fd21
283277

284278
PENDING MGS-MANAGED UPDATES: 0
285279

280+
planning report for blueprint 8da82a8e-bf97-4fbd-8ddd-9f6462732cf1:
281+
chicken switches:
282+
add zones with mupdate override: false
283+
284+
* no zpools in service for NTP zones on sleds: 00320471-945d-413c-85e7-03e091a70b3c
285+
* discretionary zone placement waiting for NTP zones on sleds: 00320471-945d-413c-85e7-03e091a70b3c
286+
287+
286288

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

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,9 @@ parent: 02697f74-b14a-4418-90f0-c28b2a3a6aa9
402402

403403
PENDING MGS-MANAGED UPDATES: 0
404404

405+
empty planning report for blueprint ade5749d-bdf3-4fab-a8ae-00bea01b3a5a.
406+
407+
405408

406409

407410
> inventory-generate
@@ -518,6 +521,9 @@ parent: 02697f74-b14a-4418-90f0-c28b2a3a6aa9
518521

519522
PENDING MGS-MANAGED UPDATES: 0
520523

524+
empty planning report for blueprint ade5749d-bdf3-4fab-a8ae-00bea01b3a5a.
525+
526+
521527

522528

523529
> # Exercise `blueprint-diff` arguments.
@@ -544,21 +550,20 @@ T ENA ID PARENT
544550

545551
> blueprint-plan ade5749d-bdf3-4fab-a8ae-00bea01b3a5a
546552
INFO skipping noop image source check for all sleds, reason: no target release is currently set
547-
INFO found sled missing NTP zone (will add one), sled_id: 89d02b1b-478c-401a-8e28-7a26f74fa41b
548-
INFO sufficient BoundaryNtp zones exist in plan, desired_count: 0, current_count: 0
549-
WARN failed to place all new desired Clickhouse zones, placed: 0, wanted_to_place: 1
550-
INFO sufficient ClickhouseKeeper zones exist in plan, desired_count: 0, current_count: 0
551-
INFO sufficient ClickhouseServer zones exist in plan, desired_count: 0, current_count: 0
552-
INFO sufficient CockroachDb zones exist in plan, desired_count: 0, current_count: 0
553-
WARN failed to place all new desired CruciblePantry zones, placed: 0, wanted_to_place: 3
554-
WARN failed to place all new desired InternalDns zones, placed: 0, wanted_to_place: 3
555-
INFO sufficient ExternalDns zones exist in plan, desired_count: 0, current_count: 0
556-
WARN failed to place all new desired Nexus zones, placed: 0, wanted_to_place: 3
557-
INFO sufficient Oximeter zones exist in plan, desired_count: 0, current_count: 0
558553
WARN cannot issue more MGS-driven updates (no current artifacts)
559554
INFO some zones not yet up-to-date, sled_id: 89d02b1b-478c-401a-8e28-7a26f74fa41b, zones_currently_updating: [ZoneCurrentlyUpdating { zone_id: b3c9c041-d2f0-4767-bdaf-0e52e9d7a013 (service), zone_kind: InternalNtp, reason: MissingInInventory { bp_image_source: InstallDataset } }]
560-
INFO will ensure cockroachdb setting, setting: cluster.preserve_downgrade_option, value: DoNotModify
561555
generated blueprint 86db3308-f817-4626-8838-4085949a6a41 based on parent blueprint ade5749d-bdf3-4fab-a8ae-00bea01b3a5a
556+
planning report for blueprint 86db3308-f817-4626-8838-4085949a6a41:
557+
chicken switches:
558+
add zones with mupdate override: false
559+
560+
* discretionary zone placement waiting for NTP zones on sleds: 89d02b1b-478c-401a-8e28-7a26f74fa41b
561+
* missing NTP zone on sled 89d02b1b-478c-401a-8e28-7a26f74fa41b
562+
* only placed 0/1 desired clickhouse zones
563+
* only placed 0/3 desired crucible_pantry zones
564+
* only placed 0/3 desired internal_dns zones
565+
* only placed 0/3 desired nexus zones
566+
562567

563568
> blueprint-list
564569
T ENA ID PARENT TIME_CREATED
@@ -1030,6 +1035,9 @@ parent: 02697f74-b14a-4418-90f0-c28b2a3a6aa9
10301035

10311036
PENDING MGS-MANAGED UPDATES: 0
10321037

1038+
empty planning report for blueprint ade5749d-bdf3-4fab-a8ae-00bea01b3a5a.
1039+
1040+
10331041

10341042
> inventory-show latest all
10351043
collection: 9e187896-7809-46d0-9210-d75be1b3c4d4
@@ -1575,20 +1583,10 @@ INTERNAL DNS STATUS
15751583
> # sled to be expunged.
15761584
> blueprint-plan latest
15771585
INFO skipping noop image source check for all sleds, reason: no target release is currently set
1578-
INFO sufficient BoundaryNtp zones exist in plan, desired_count: 0, current_count: 0
1579-
INFO sufficient Clickhouse zones exist in plan, desired_count: 1, current_count: 1
1580-
INFO sufficient ClickhouseKeeper zones exist in plan, desired_count: 0, current_count: 0
1581-
INFO sufficient ClickhouseServer zones exist in plan, desired_count: 0, current_count: 0
1582-
INFO sufficient CockroachDb zones exist in plan, desired_count: 0, current_count: 0
1583-
INFO sufficient CruciblePantry zones exist in plan, desired_count: 3, current_count: 3
1584-
INFO sufficient InternalDns zones exist in plan, desired_count: 3, current_count: 3
1585-
INFO sufficient ExternalDns zones exist in plan, desired_count: 3, current_count: 3
1586-
INFO sufficient Nexus zones exist in plan, desired_count: 3, current_count: 3
1587-
INFO sufficient Oximeter zones exist in plan, desired_count: 0, current_count: 0
15881586
WARN cannot issue more MGS-driven updates (no current artifacts)
1589-
INFO all zones up-to-date
1590-
INFO will ensure cockroachdb setting, setting: cluster.preserve_downgrade_option, value: DoNotModify
15911587
generated blueprint 86db3308-f817-4626-8838-4085949a6a41 based on parent blueprint ade5749d-bdf3-4fab-a8ae-00bea01b3a5a
1588+
empty planning report for blueprint 86db3308-f817-4626-8838-4085949a6a41.
1589+
15921590

15931591
> blueprint-diff ade5749d-bdf3-4fab-a8ae-00bea01b3a5a latest
15941592
from: blueprint ade5749d-bdf3-4fab-a8ae-00bea01b3a5a

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

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,9 @@ parent: 06c88262-f435-410e-ba98-101bed41ec27
334334

335335
PENDING MGS-MANAGED UPDATES: 0
336336

337+
empty planning report for blueprint 3f00b694-1b16-4aaa-8f78-e6b3a527b434.
338+
339+
337340

338341
> blueprint-edit 3f00b694-1b16-4aaa-8f78-e6b3a527b434 expunge-zone 8429c772-07e8-40a6-acde-2ed47d16cf84
339342
blueprint 366b0b68-d80e-4bc1-abd3-dc69837847e0 created from blueprint 3f00b694-1b16-4aaa-8f78-e6b3a527b434: expunged zone 8429c772-07e8-40a6-acde-2ed47d16cf84 from sled 711ac7f8-d19e-4572-bdb9-e9b50f6e362a
@@ -1022,24 +1025,23 @@ parent: 3f00b694-1b16-4aaa-8f78-e6b3a527b434
10221025

10231026
PENDING MGS-MANAGED UPDATES: 0
10241027

1028+
empty planning report for blueprint 366b0b68-d80e-4bc1-abd3-dc69837847e0.
1029+
1030+
10251031

10261032
> # blueprint-plan will place a new external DNS zone, diff DNS to see the new zone has `ns<N>` and NS records.
10271033
> blueprint-plan 366b0b68-d80e-4bc1-abd3-dc69837847e0
10281034
INFO skipping noop image source check for all sleds, reason: no target release is currently set
1029-
INFO sufficient BoundaryNtp zones exist in plan, desired_count: 0, current_count: 0
1030-
INFO sufficient Clickhouse zones exist in plan, desired_count: 1, current_count: 1
1031-
INFO sufficient ClickhouseKeeper zones exist in plan, desired_count: 0, current_count: 0
1032-
INFO sufficient ClickhouseServer zones exist in plan, desired_count: 0, current_count: 0
1033-
INFO sufficient CockroachDb zones exist in plan, desired_count: 0, current_count: 0
1034-
INFO sufficient CruciblePantry zones exist in plan, desired_count: 3, current_count: 3
1035-
INFO sufficient InternalDns zones exist in plan, desired_count: 3, current_count: 3
1036-
INFO added zone to sled, sled_id: 711ac7f8-d19e-4572-bdb9-e9b50f6e362a, kind: ExternalDns
1037-
INFO sufficient Nexus zones exist in plan, desired_count: 3, current_count: 3
1038-
INFO sufficient Oximeter zones exist in plan, desired_count: 0, current_count: 0
10391035
WARN cannot issue more MGS-driven updates (no current artifacts)
1040-
INFO some zones not yet up-to-date, sled_id: 711ac7f8-d19e-4572-bdb9-e9b50f6e362a, zones_currently_updating: [ZoneCurrentlyUpdating { zone_id: fe2d5287-24e3-4071-b214-2640b097a759 (service), zone_kind: ExternalDns, reason: MissingInInventory { bp_image_source: InstallDataset } }]
1041-
INFO will ensure cockroachdb setting, setting: cluster.preserve_downgrade_option, value: DoNotModify
10421036
generated blueprint 9c998c1d-1a7b-440a-ae0c-40f781dea6e2 based on parent blueprint 366b0b68-d80e-4bc1-abd3-dc69837847e0
1037+
planning report for blueprint 9c998c1d-1a7b-440a-ae0c-40f781dea6e2:
1038+
chicken switches:
1039+
add zones with mupdate override: false
1040+
1041+
* discretionary zones placed:
1042+
* 1 zone on sled 711ac7f8-d19e-4572-bdb9-e9b50f6e362a: external_dns
1043+
* zone updates waiting on discretionary zones
1044+
10431045

10441046
> blueprint-diff 366b0b68-d80e-4bc1-abd3-dc69837847e0 9c998c1d-1a7b-440a-ae0c-40f781dea6e2
10451047
from: blueprint 366b0b68-d80e-4bc1-abd3-dc69837847e0
@@ -1726,6 +1728,15 @@ parent: 366b0b68-d80e-4bc1-abd3-dc69837847e0
17261728

17271729
PENDING MGS-MANAGED UPDATES: 0
17281730

1731+
planning report for blueprint 9c998c1d-1a7b-440a-ae0c-40f781dea6e2:
1732+
chicken switches:
1733+
add zones with mupdate override: false
1734+
1735+
* discretionary zones placed:
1736+
* 1 zone on sled 711ac7f8-d19e-4572-bdb9-e9b50f6e362a: external_dns
1737+
* zone updates waiting on discretionary zones
1738+
1739+
17291740

17301741
> # expunging the new zone should work, then diff again to see the new zone also have its DNS records removed.
17311742
> blueprint-edit 9c998c1d-1a7b-440a-ae0c-40f781dea6e2 expunge-zone 8c0a1969-15b6-4165-ba6d-a27c24151037

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

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,9 @@ parent: 184f10b3-61cb-41ef-9b93-3489b2bac559
332332

333333
PENDING MGS-MANAGED UPDATES: 0
334334

335+
empty planning report for blueprint dbcbd3d6-41ff-48ae-ac0b-1becc9b2fd21.
336+
337+
335338

336339
> # Expunge an internal DNS zone
337340
> blueprint-edit dbcbd3d6-41ff-48ae-ac0b-1becc9b2fd21 expunge-zone 99e2f30b-3174-40bf-a78a-90da8abba8ca
@@ -1043,20 +1046,16 @@ external DNS:
10431046
> # Planning a new blueprint will now replace the expunged zone, with new records for its replacement.
10441047
> blueprint-plan 58d5e830-0884-47d8-a7cd-b2b3751adeb4
10451048
INFO skipping noop image source check for all sleds, reason: no target release is currently set
1046-
INFO sufficient BoundaryNtp zones exist in plan, desired_count: 0, current_count: 0
1047-
INFO sufficient Clickhouse zones exist in plan, desired_count: 1, current_count: 1
1048-
INFO sufficient ClickhouseKeeper zones exist in plan, desired_count: 0, current_count: 0
1049-
INFO sufficient ClickhouseServer zones exist in plan, desired_count: 0, current_count: 0
1050-
INFO sufficient CockroachDb zones exist in plan, desired_count: 0, current_count: 0
1051-
INFO sufficient CruciblePantry zones exist in plan, desired_count: 3, current_count: 3
1052-
INFO added zone to sled, sled_id: 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c, kind: InternalDns
1053-
INFO sufficient ExternalDns zones exist in plan, desired_count: 3, current_count: 3
1054-
INFO sufficient Nexus zones exist in plan, desired_count: 3, current_count: 3
1055-
INFO sufficient Oximeter zones exist in plan, desired_count: 0, current_count: 0
10561049
WARN cannot issue more MGS-driven updates (no current artifacts)
1057-
INFO some zones not yet up-to-date, sled_id: 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c, zones_currently_updating: [ZoneCurrentlyUpdating { zone_id: e375dd21-320b-43b7-bc92-a2c3dac9d9e1 (service), zone_kind: InternalDns, reason: MissingInInventory { bp_image_source: InstallDataset } }]
1058-
INFO will ensure cockroachdb setting, setting: cluster.preserve_downgrade_option, value: DoNotModify
10591050
generated blueprint af934083-59b5-4bf6-8966-6fb5292c29e1 based on parent blueprint 58d5e830-0884-47d8-a7cd-b2b3751adeb4
1051+
planning report for blueprint af934083-59b5-4bf6-8966-6fb5292c29e1:
1052+
chicken switches:
1053+
add zones with mupdate override: false
1054+
1055+
* discretionary zones placed:
1056+
* 1 zone on sled 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c: internal_dns
1057+
* zone updates waiting on discretionary zones
1058+
10601059

10611060
> blueprint-diff 58d5e830-0884-47d8-a7cd-b2b3751adeb4 af934083-59b5-4bf6-8966-6fb5292c29e1
10621061
from: blueprint 58d5e830-0884-47d8-a7cd-b2b3751adeb4

dev-tools/reconfigurator-cli/tests/output/cmds-host-phase-2-source-stdout

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,9 @@ parent: 8da82a8e-bf97-4fbd-8ddd-9f6462732cf1
712712

713713
PENDING MGS-MANAGED UPDATES: 0
714714

715+
empty planning report for blueprint 58d5e830-0884-47d8-a7cd-b2b3751adeb4.
716+
717+
715718

716719

717720
> # Restore A to "current contents"
@@ -1419,4 +1422,7 @@ parent: af934083-59b5-4bf6-8966-6fb5292c29e1
14191422

14201423
PENDING MGS-MANAGED UPDATES: 0
14211424

1425+
empty planning report for blueprint df06bb57-ad42-4431-9206-abff322896c7.
1426+
1427+
14221428

0 commit comments

Comments
 (0)