Skip to content

Commit 1a65ac4

Browse files
committed
Cancel the watchdog before deactivating SMAPIv1 VDI
Previously the tapdisk watchdog in SMAPIv1 mirroring was cancelled in the `post_deactivate_hook`, but at that point the VDI has already been deactivated, and hence the mirror would have been terminated. Additionally, the last time the stats is retrieved is in `pre_deactivate_hook`, so do this cancelling after the last stats retrival. Note that SMAPIv3 mirror does not have a watchdog due to the limitations of the mirror job auto cancel after guest pause, so instead the mirror checking is only done whilst the mirror syncing (i.e. copying existing disk content) is in progress. Signed-off-by: Vincent Liu <[email protected]>
1 parent 4409be8 commit 1a65ac4

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

ocaml/xapi/storage_migrate.ml

+1-2
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,7 @@ let post_deactivate_hook ~sr ~vdi ~dp:_ =
331331
) ;
332332
debug "Finished calling receive_finalize2" ;
333333
State.remove_local_mirror id ;
334-
debug "Removed active local mirror: %s" id ;
335-
Option.iter (fun id -> Scheduler.cancel scheduler id) r.watchdog
334+
debug "Removed active local mirror: %s" id
336335
)
337336

338337
let nbd_handler req s ?(vm = "0") sr vdi dp =

ocaml/xapi/storage_smapiv1_migrate.ml

+4-1
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,10 @@ module MIRROR : SMAPIv2_MIRROR = struct
801801
if st.Stats.nbd_mirror_failed = 1 then (
802802
D.error "tapdisk reports mirroring failed" ;
803803
s.failed <- true
804-
)
804+
) ;
805+
Option.iter
806+
(fun id -> Scheduler.cancel scheduler id)
807+
s.watchdog
805808
with
806809
| Timeout elapsed ->
807810
D.error

0 commit comments

Comments
 (0)