@@ -24,7 +24,7 @@ use uuid::Uuid;
2424pub ( crate ) struct Params {
2525 pub serialized_authn : authn:: saga:: Serialized ,
2626 pub project_id : Uuid ,
27- pub disk : datastore:: CrucibleDisk ,
27+ pub disk : datastore:: Disk ,
2828}
2929
3030// disk delete saga: actions
@@ -60,36 +60,41 @@ impl NexusSaga for SagaDiskDelete {
6060 builder. append ( delete_disk_record_action ( ) ) ;
6161 builder. append ( space_account_action ( ) ) ;
6262
63- let subsaga_params = volume_delete:: Params {
64- serialized_authn : params. serialized_authn . clone ( ) ,
65- volume_id : params. disk . volume_id ( ) ,
66- } ;
67-
68- let subsaga_dag = {
69- let subsaga_builder = steno:: DagBuilder :: new ( steno:: SagaName :: new (
70- volume_delete:: SagaVolumeDelete :: NAME ,
71- ) ) ;
72- volume_delete:: SagaVolumeDelete :: make_saga_dag (
73- & subsaga_params,
74- subsaga_builder,
75- ) ?
76- } ;
77-
78- builder. append ( Node :: constant (
79- "params_for_volume_delete_subsaga" ,
80- serde_json:: to_value ( & subsaga_params) . map_err ( |e| {
81- SagaInitError :: SerializeError (
82- "params_for_volume_delete_subsaga" . to_string ( ) ,
83- e,
84- )
85- } ) ?,
86- ) ) ;
87-
88- builder. append ( Node :: subsaga (
89- "volume_delete_subsaga_no_result" ,
90- subsaga_dag,
91- "params_for_volume_delete_subsaga" ,
92- ) ) ;
63+ match & params. disk {
64+ datastore:: Disk :: Crucible ( disk) => {
65+ let subsaga_params = volume_delete:: Params {
66+ serialized_authn : params. serialized_authn . clone ( ) ,
67+ volume_id : disk. volume_id ( ) ,
68+ } ;
69+
70+ let subsaga_dag = {
71+ let subsaga_builder =
72+ steno:: DagBuilder :: new ( steno:: SagaName :: new (
73+ volume_delete:: SagaVolumeDelete :: NAME ,
74+ ) ) ;
75+ volume_delete:: SagaVolumeDelete :: make_saga_dag (
76+ & subsaga_params,
77+ subsaga_builder,
78+ ) ?
79+ } ;
80+
81+ builder. append ( Node :: constant (
82+ "params_for_volume_delete_subsaga" ,
83+ serde_json:: to_value ( & subsaga_params) . map_err ( |e| {
84+ SagaInitError :: SerializeError (
85+ "params_for_volume_delete_subsaga" . to_string ( ) ,
86+ e,
87+ )
88+ } ) ?,
89+ ) ) ;
90+
91+ builder. append ( Node :: subsaga (
92+ "volume_delete_subsaga_no_result" ,
93+ subsaga_dag,
94+ "params_for_volume_delete_subsaga" ,
95+ ) ) ;
96+ }
97+ }
9398
9499 Ok ( builder. build ( ) ?)
95100 }
@@ -186,7 +191,6 @@ pub(crate) mod test {
186191 } ;
187192 use nexus_db_queries:: authn:: saga:: Serialized ;
188193 use nexus_db_queries:: context:: OpContext ;
189- use nexus_db_queries:: db:: datastore:: CrucibleDisk ;
190194 use nexus_db_queries:: db:: datastore:: Disk ;
191195 use nexus_test_utils:: resource_helpers:: DiskTest ;
192196 use nexus_test_utils:: resource_helpers:: create_project;
@@ -206,7 +210,7 @@ pub(crate) mod test {
206210 )
207211 }
208212
209- async fn create_disk ( cptestctx : & ControlPlaneTestContext ) -> CrucibleDisk {
213+ async fn create_disk ( cptestctx : & ControlPlaneTestContext ) -> Disk {
210214 let nexus = & cptestctx. server . server_context ( ) . nexus ;
211215 let opctx = test_opctx ( & cptestctx) ;
212216
@@ -217,18 +221,14 @@ pub(crate) mod test {
217221 let project_lookup =
218222 nexus. project_lookup ( & opctx, project_selector) . unwrap ( ) ;
219223
220- let disk = nexus
224+ nexus
221225 . project_create_disk (
222226 & opctx,
223227 & project_lookup,
224228 & crate :: app:: sagas:: disk_create:: test:: new_disk_create_params ( ) ,
225229 )
226230 . await
227- . expect ( "Failed to create disk" ) ;
228-
229- match disk {
230- Disk :: Crucible ( disk) => disk,
231- }
231+ . expect ( "Failed to create disk" )
232232 }
233233
234234 #[ nexus_test( server = crate :: Server ) ]
0 commit comments