From ba3a6d5bc092945625fcd89b3f544c1f0b968199 Mon Sep 17 00:00:00 2001 From: Pau Ruiz Safont Date: Tue, 24 Dec 2024 10:19:41 +0000 Subject: [PATCH] rrdd: do not half-update the metrics' datastructures of paused vms THe intent of the code was to either update the rrdi of the vm when it's unpaused, or don't update it. A recent patch unintendedly changed the behaviour to update the rrd regardless. Signed-off-by: Pau Ruiz Safont --- ocaml/xcp-rrdd/bin/rrdd/rrdd_monitor.ml | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/ocaml/xcp-rrdd/bin/rrdd/rrdd_monitor.ml b/ocaml/xcp-rrdd/bin/rrdd/rrdd_monitor.ml index c46a33d6f9..0f1703a495 100644 --- a/ocaml/xcp-rrdd/bin/rrdd/rrdd_monitor.ml +++ b/ocaml/xcp-rrdd/bin/rrdd/rrdd_monitor.ml @@ -227,20 +227,21 @@ let update_rrds uuid_domids paused_vms plugins_dss = (* First, potentially update the rrd with any new default dss *) match vm_rrd with | Some rrdi -> - let updated_dss, rrd = merge_new_dss rrdi dss in (* CA-34383: Memory updates from paused domains serve no useful purpose. During a migrate such updates can also cause undesirable discontinuities in the observed value of memory_actual. Hence, we ignore changes from paused domains: *) - ( if not (StringSet.mem vm_uuid paused_vms) then - let named_updates = - StringMap.map to_named_updates dss - in - Rrd.ds_update_named rrd - ~new_rrd:(domid <> rrdi.domid) timestamp - named_updates - ) ; - Some {rrd; dss= updated_dss; domid} + if not (StringSet.mem vm_uuid paused_vms) then ( + let named_updates = + StringMap.map to_named_updates dss + in + let dss, rrd = merge_new_dss rrdi dss in + Rrd.ds_update_named rrd + ~new_rrd:(domid <> rrdi.domid) timestamp + named_updates ; + Some {rrd; dss; domid} + ) else + Some rrdi | None -> debug "%s: Creating fresh RRD for VM uuid=%s" __FUNCTION__ vm_uuid ;