# HG changeset patch # User Jon Ludlam # Date 1278590100 -3600 # Node ID 8499f649a11392161b050fa39e0eeb69c58aa84a # Parent 9a444f4ab686fb2e391138708b32a3853517e130 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 9a444f4ab686 -r 8499f649a113 ocaml/xapi/events.ml --- a/ocaml/xapi/events.ml Thu Jul 08 12:54:49 2010 +0100 +++ b/ocaml/xapi/events.ml Thu Jul 08 12:55:00 2010 +0100 @@ -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 9a444f4ab686 -r 8499f649a113 ocaml/xapi/vbdops.ml --- a/ocaml/xapi/vbdops.ml Thu Jul 08 12:54:49 2010 +0100 +++ b/ocaml/xapi/vbdops.ml Thu Jul 08 12:55:00 2010 +0100 @@ -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;