File tree Expand file tree Collapse file tree 3 files changed +22
-3
lines changed
Expand file tree Collapse file tree 3 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,11 @@ let clear_cache_for_vm ~vm_uuid =
4646 Mutex. execute vm_memory_cached_m
4747 (fun _ -> Hashtbl. remove vm_memory_cached vm_uuid)
4848
49+ (* * [clear_pvs_status_cache] removes the cache entry for [vm_uuid] *)
50+ let clear_pvs_status_cache ~vm_uuid =
51+ Mutex. execute pvs_proxy_cached_m
52+ (fun _ -> Hashtbl. remove pvs_proxy_cached vm_uuid)
53+
4954(* * Clear the whole cache. This forces fresh properties to be written into
5055 * xapi's database. *)
5156let clear_cache () =
Original file line number Diff line number Diff line change @@ -32,6 +32,18 @@ let find_rrd_files () =
3232 |> Array. to_list
3333 |> List. filter (String. startswith metrics_prefix)
3434
35+ (* The PVS Proxy status cache [pvs_proxy_cached] contains the status
36+ * entries from PVS Proxies as reported via RRD. When the status
37+ * changes, it is updated in the xapi database. However: The xapi
38+ * databse is only updated for proxies that are currently attached.
39+ * This can lead to divergence between the cache and the database,
40+ * leading to error CA-229176. When the PVS Proxy is attached in
41+ * xapi_xenops.ml, the cache entry for the PVS Proxy is invalidated
42+ * such that it is picked up again and updated in the xapi database.
43+ * Inconsistencies are thus limited to the time between when a PVS
44+ * Proxy starts reporting its status and when it is attached.
45+ *)
46+
3547let get_changes () =
3648 List. iter (fun filename ->
3749 try
Original file line number Diff line number Diff line change @@ -1709,9 +1709,11 @@ let update_vif ~__context id =
17091709 | None -> ()
17101710 | Some proxy ->
17111711 debug " xenopsd event: Updating PVS_proxy for VIF %s.%s currently_attached <- %b" (fst id) (snd id) state.pvs_rules_active;
1712- if state.pvs_rules_active then
1713- Db.PVS_proxy. set_currently_attached ~__context ~self: proxy ~value: true
1714- else
1712+ if state.pvs_rules_active then begin
1713+ Db.PVS_proxy. set_currently_attached ~__context ~self: proxy ~value: true ;
1714+ (* force status to be read again by invalidating cache *)
1715+ Monitor_dbcalls_cache. clear_pvs_status_cache (fst id)
1716+ end else
17151717 Pvs_proxy_control. clear_proxy_state ~__context vif proxy
17161718 );
17171719 debug " xenopsd event: Updating VIF %s.%s currently_attached <- %b" (fst id) (snd id) (state.plugged || state.active);
You can’t perform that action at this time.
0 commit comments