Skip to content

Commit

Permalink
Merge pull request #279 from kc284/master
Browse files Browse the repository at this point in the history
CA-216683: When unplugging VBD destroy the datapath only if the backe…
  • Loading branch information
Jon Ludlam authored Jul 28, 2016
2 parents 4e174ab + d723d4b commit 1c7567d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions xc/xenops_server_xen.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2047,6 +2047,9 @@ module VBD = struct
| Device_not_connected ->
debug "VM = %s; VBD = %s; Ignoring missing device" vm (id_of vbd);
None in
let backend = match device with
| None -> None
| Some dv -> Device.Generic.get_private_key ~xs dv _vdi_id |> Jsonrpc.of_string |> backend_of_rpc in
Opt.iter
(fun device ->
if force && (not (Device.can_surprise_remove ~xs device))
Expand All @@ -2057,7 +2060,7 @@ module VBD = struct
Xenops_task.with_subtask task (Printf.sprintf "Vbd.clean_shutdown %s" (id_of vbd))
(fun () -> (if force then Device.hard_shutdown else Device.clean_shutdown) task ~xs device);
) device;
(* We now have a shutdown device but an active DP: we should unconditionally destroy the DP *)
(* We now have a shutdown device but an active DP: we should destroy the DP if the backend is of type VDI *)
finally
(fun () ->
Opt.iter
Expand All @@ -2081,9 +2084,9 @@ module VBD = struct
)
)
(fun () ->
Opt.iter (fun domid ->
Storage.dp_destroy task (Storage.id_of (string_of_int domid) vbd.Vbd.id)
) domid
match domid, backend with
| Some x, Some (VDI _) -> Storage.dp_destroy task (Storage.id_of (string_of_int x) vbd.Vbd.id)
| _ -> ()
)
with
| Device_common.Device_error(_, s) ->
Expand Down

0 comments on commit 1c7567d

Please sign in to comment.