Skip to content

Commit

Permalink
Merge pull request #45 from sharady/CA-248332
Browse files Browse the repository at this point in the history
CA-248332: Fix race condition in iostat while updating VDI-to-VM map.
  • Loading branch information
Jon Ludlam authored Apr 21, 2017
2 parents a53ed5e + e629486 commit 3899dba
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/rrdp_iostat.ml
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ let exec_tap_ctl () =
update_vdi_to_vm_map ()
end else
let disappeared_pids = List.set_difference !previous_map pid_and_minor_to_sr_and_vdi in
let appeared_pids = List.set_difference pid_and_minor_to_sr_and_vdi !previous_map in
let unmapped_vdi_pids = List.filter (fun (_, (_, (_, vdi))) -> not (List.mem_assoc vdi !vdi_to_vm_map)) pid_and_minor_to_sr_and_vdi in

List.iter (fun (pid, (_, (_, vdi))) ->
try
Expand All @@ -268,9 +268,9 @@ let exec_tap_ctl () =
D.debug "no knowledge about pid %d; ignoring" pid
) disappeared_pids;

if appeared_pids <> [] then begin
if unmapped_vdi_pids <> [] then begin
let pids_to_string pids = pids |> List.map (fun (pid, (_, (_, vdi))) -> Printf.sprintf "%d (%s)" pid vdi) |> String.concat "; " in
D.info "There are new tapdisk processes: [%s]; updating VDI-to-VM map..." (pids_to_string appeared_pids);
D.info "There are new tapdisk processes: [%s]; updating VDI-to-VM map..." (pids_to_string unmapped_vdi_pids);
(* Unfortunately the only way of identifying which VMs the new tapdisks service is to refresh the entire map *)
update_vdi_to_vm_map ()
end
Expand Down

0 comments on commit 3899dba

Please sign in to comment.