Skip to content

Commit

Permalink
CA-405502: Change post_detach to post_deactivate
Browse files Browse the repository at this point in the history
Previously the `post_detach_hook` was run after the VDI is detached on
the source VM, which is at the very end of the SXM, where the source VM
is shutdown. However, the job of `post_detach_hook` is to call
`Remote.receive_finalize` which will destroy the mirroring datapath.
This should have been called as soon as we deactivate the datapath on
the source VM, at which point the source VM will stop writing using that
datapath. This commit changes `post_detach_hook` to
`post_deactivate_hook` and moves its calling locations accordingly.

Signed-off-by: Vincent Liu <[email protected]>
  • Loading branch information
Vincent-lau committed Jan 28, 2025
1 parent bd3024b commit 764ec0d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ocaml/xapi/storage_migrate.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1320,7 +1320,7 @@ let pre_deactivate_hook ~dbg:_ ~dp:_ ~sr ~vdi =
s.failed <- true
)

let post_detach_hook ~sr ~vdi ~dp:_ =
let post_deactivate_hook ~sr ~vdi ~dp:_ =
let open State.Send_state in
let id = State.mirror_id_of (sr, vdi) in
State.find_active_local_mirror id
Expand Down
2 changes: 1 addition & 1 deletion ocaml/xapi/storage_smapiv1_wrapper.ml
Original file line number Diff line number Diff line change
Expand Up @@ -422,10 +422,10 @@ functor
| Vdi_automaton.Deactivate ->
Storage_migrate.pre_deactivate_hook ~dbg ~dp ~sr ~vdi ;
Impl.VDI.deactivate context ~dbg ~dp ~sr ~vdi ~vm ;
Storage_migrate.post_deactivate_hook ~sr ~vdi ~dp ;
vdi_t
| Vdi_automaton.Detach ->
Impl.VDI.detach context ~dbg ~dp ~sr ~vdi ~vm ;
Storage_migrate.post_detach_hook ~sr ~vdi ~dp ;
vdi_t
in
Sr.add_or_replace vdi new_vdi_t sr_t ;
Expand Down

0 comments on commit 764ec0d

Please sign in to comment.