Skip to content

Commit 823f8ab

Browse files
authored
[#5333 3/6] Region snapshot replacement start (#6294)
This commit adds a "region snapshot replacement start" background task that will: 1) check for snapshots that are stored on disks that were expunged, and insert region snapshot replacement requests for them. 2) check if there are any region snapshot replacement requests in the `Requested` state and run the new "region snapshot replacement start" saga for them. This background task will also pick up manually requested region snapshot replacements. Also in this commit is the "region snapshot replacement start saga", which will transition a region snapshot replacement request from `Requested` to `Allocating` and: - allocate a new Region (with source set to Some so that a clone occurs) - create a blank Volume that will be used to stash the snapshot to delete later - swap the snapshot being replaced with the new region that was cloned from the others in the read-only region set - update the region snapshot replacement request's state to "ReplacementDone" and clearing the operating saga id This represents the first step to be taken after a snapshot goes away: allocate the replacement, and swap it in to the affected snapshot volume. Once this is done, anything that uses the snapshot volume as a read-only parent will no longer reference the expunged snapshot, and will work without any issues. Existing constructed Volumes running in a propolis or pantry context will remain unmodified: a future commit will contain the saga that takes care of performing the necessary read-only target replacements.
1 parent 5ccb386 commit 823f8ab

File tree

25 files changed

+1994
-43
lines changed

25 files changed

+1994
-43
lines changed

Cargo.lock

Lines changed: 159 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ crossterm = { version = "0.28.1", features = ["event-stream"] }
307307
crucible-agent-client = { git = "https://github.com/oxidecomputer/crucible", rev = "e58ca3693cb9ce0438947beba10e97ee38a0966b" }
308308
crucible-pantry-client = { git = "https://github.com/oxidecomputer/crucible", rev = "e58ca3693cb9ce0438947beba10e97ee38a0966b" }
309309
crucible-smf = { git = "https://github.com/oxidecomputer/crucible", rev = "e58ca3693cb9ce0438947beba10e97ee38a0966b" }
310+
crucible-common = { git = "https://github.com/oxidecomputer/crucible", rev = "e58ca3693cb9ce0438947beba10e97ee38a0966b" }
310311
csv = "1.3.0"
311312
curve25519-dalek = "4"
312313
datatest-stable = "0.2.9"

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

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ use nexus_saga_recovery::LastPass;
3333
use nexus_types::deployment::Blueprint;
3434
use nexus_types::internal_api::background::LookupRegionPortStatus;
3535
use nexus_types::internal_api::background::RegionReplacementDriverStatus;
36+
use nexus_types::internal_api::background::RegionSnapshotReplacementStartStatus;
3637
use nexus_types::inventory::BaseboardId;
3738
use omicron_uuid_kinds::CollectionUuid;
3839
use omicron_uuid_kinds::DemoSagaUuid;
@@ -1394,6 +1395,38 @@ fn print_task_details(bgtask: &BackgroundTask, details: &serde_json::Value) {
13941395
}
13951396
}
13961397
};
1398+
} else if name == "region_snapshot_replacement" {
1399+
match serde_json::from_value::<RegionSnapshotReplacementStartStatus>(
1400+
details.clone(),
1401+
) {
1402+
Err(error) => eprintln!(
1403+
"warning: failed to interpret task details: {:?}: {:?}",
1404+
error, details
1405+
),
1406+
1407+
Ok(status) => {
1408+
println!(
1409+
" total requests created ok: {}",
1410+
status.requests_created_ok.len(),
1411+
);
1412+
for line in &status.requests_created_ok {
1413+
println!(" > {line}");
1414+
}
1415+
1416+
println!(
1417+
" total start saga invoked ok: {}",
1418+
status.start_invoked_ok.len(),
1419+
);
1420+
for line in &status.start_invoked_ok {
1421+
println!(" > {line}");
1422+
}
1423+
1424+
println!(" errors: {}", status.errors.len());
1425+
for line in &status.errors {
1426+
println!(" > {line}");
1427+
}
1428+
}
1429+
}
13971430
} else {
13981431
println!(
13991432
"warning: unknown background task: {:?} \

dev-tools/omdb/tests/env.out

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ task: "region_replacement_driver"
127127
drive region replacements forward to completion
128128

129129

130+
task: "region_snapshot_replacement_start"
131+
detect if region snapshots need replacement and begin the process
132+
133+
130134
task: "saga_recovery"
131135
recovers sagas assigned to this Nexus
132136

@@ -276,6 +280,10 @@ task: "region_replacement_driver"
276280
drive region replacements forward to completion
277281

278282

283+
task: "region_snapshot_replacement_start"
284+
detect if region snapshots need replacement and begin the process
285+
286+
279287
task: "saga_recovery"
280288
recovers sagas assigned to this Nexus
281289

@@ -412,6 +420,10 @@ task: "region_replacement_driver"
412420
drive region replacements forward to completion
413421

414422

423+
task: "region_snapshot_replacement_start"
424+
detect if region snapshots need replacement and begin the process
425+
426+
415427
task: "saga_recovery"
416428
recovers sagas assigned to this Nexus
417429

0 commit comments

Comments
 (0)