# HG changeset patch # User Jonathan Ludlam # Date 1277129371 -3600 # Node ID ffb8d0b1eb59a41c105ed76b877f247716804829 # Parent 6e91088f70324d1d361cd51c6de5b1472131f9f3 When a VBD unplug event is caught by the event thread, it issues a VDI.detach but not a VDI.deactivate. This fixes this behaviour. Also does the same for eject (although no ISO SRs currently use activate/deactivate) Signed-off-by: Jon Ludlam diff -r 6e91088f7032 -r ffb8d0b1eb59 ocaml/xapi/events.ml --- a/ocaml/xapi/events.ml +++ b/ocaml/xapi/events.ml @@ -253,7 +253,7 @@ Device.Generic.rm_device_state ~xs device; let vdi = Db.VBD.get_VDI ~__context ~self:vbd in if exists - then Storage_access.VDI.detach ~__context ~self:vdi + then Storage_access.deactivate_and_detach ~__context ~vdi else debug "VBD %s: Skipping VDI.detach of %s since device doesn't exist" (Ref.string_of vbd) (Ref.string_of vdi) ); (* If VM is suspended, leave currently_attached and the VDI lock diff -r 6e91088f7032 -r ffb8d0b1eb59 ocaml/xapi/vbdops.ml --- a/ocaml/xapi/vbdops.ml +++ b/ocaml/xapi/vbdops.ml @@ -232,7 +232,7 @@ let cmd = [| "eject"; location |] in ignore (Unixext.spawnvp cmd.(0) cmd) ); - Storage_access.VDI.detach ~__context ~self:vdi; + Storage_access.deactivate_and_detach ~__context ~vdi; ) ) else ( Db.VBD.set_empty ~__context ~self ~value:true;