Skip to content

Commit 841703a

Browse files
Jon Ludlamravippandey
authored andcommitted
SCTX-1515: Best effort VDI ops when DB rows disappear.
Signed-off-by: Jon Ludlam <[email protected]>
1 parent 165738a commit 841703a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

ocaml/xapi/storage_impl.ml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,13 @@ module Wrapper = functor(Impl: Server_impl) -> struct
300300
Impl.VDI.deactivate context ~task ~dp ~sr ~vdi, vdi_t
301301
| Vdi_automaton.Detach ->
302302
Impl.VDI.detach context ~task ~dp ~sr ~vdi, vdi_t
303-
with e ->
303+
with
304+
| Db_exn.DBCache_NotFound (err, cls, _ref) when (err="missing row" && cls="VDI" && (op=Vdi_automaton.Deactivate || op=Vdi_automaton.Detach)) ->
305+
error "Caught Db_exn.DBCache_NotFound (missing VDI) while deactivating or detaching";
306+
error "There's nothing I can really do now. I'm going to pretend it worked and hope for the best.";
307+
Success Unit, vdi_t
308+
309+
| e ->
304310
error "dp:%s sr:%s vdi:%s op:%s error:%s backtrace:%s" dp sr vdi
305311
(Vdi_automaton.string_of_op op) (Printexc.to_string e) (Printexc.get_backtrace ());
306312
Failure (Internal_error (Printexc.to_string e)), vdi_t in

0 commit comments

Comments
 (0)