Skip to content

Commit 2b5567f

Browse files
committed
attach_helpers: only control domains can leak VBDs
Gate the checks done for the other_config keys task_id and related_to to VBDs associated with control domains Signed-off-by: Pau Ruiz Safont <pau.safont@vates.tech>
1 parent 94749bf commit 2b5567f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

ocaml/xapi/attach_helpers.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,12 @@ let safe_unplug rpc session_id self =
4949
frontend (if so it will be linked to another frontend) *)
5050
let has_vbd_leaked __context vbd =
5151
let other_config = Db.VBD.get_other_config ~__context ~self:vbd in
52+
let vm = Db.VBD.get_VM ~__context ~self:vbd in
53+
let can_leak = Db.VM.get_is_control_domain ~__context ~self:vm in
5254
let device = Db.VBD.get_device ~__context ~self:vbd in
5355
let has_task = List.mem_assoc Xapi_globs.vbd_task_key other_config in
5456
let has_related = List.mem_assoc Xapi_globs.related_to_key other_config in
55-
if (not has_task) && not has_related then (
57+
if (not can_leak) || ((not has_task) && not has_related) then (
5658
info "Ignoring orphaned disk attached to control domain (device = %s)"
5759
device ;
5860
false

0 commit comments

Comments
 (0)