[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-API] [PATCH] fix glitch where VM_metrics.memory_actual sticks at 0



# HG changeset patch
# User David Scott <dave.scott@xxxxxxxxxxxxx>
# Date 1270655770 -3600
# Node ID 08ed7d25bd714e282c3fc758af3daa22db8d548d
# Parent  158b88d15a0d29c0711466c82fc948eb8e1b23ba
CA-39887: Totally throw away VM RRD updates when domains are paused.

Previously we kept the RRD data but silenced the dirty_memory signal. This 
would allow the following sequence:
1. domain created
   domain = paused; memory = 0
   <-- RRD updated with memory = 0
   <-- memory not considered 'dirty' because domain is paused
2. domain built
   domain = paused; memory = some interesting value
   <-- RRD updated with memory = some interesting value
   <-- memory not considered 'dirty' because domain is paused
3. domain unpaused
   domain = running; memory = some interesting value
   <-- RRD updated with memory = some interesting value
   <-- memory not considered 'dirty' because memory value has *not* changed in 
the RRD

Now we ignore the RRD updates when the domain is paused. This means that, when 
the domain is finally unpaused, the new memory value will always be considered 
to have changed.

Signed-off-by: David Scott <dave.scott@xxxxxxxxxxxxx>

diff -r 158b88d15a0d -r 08ed7d25bd71 ocaml/xapi/monitor_rrds.ml
--- a/ocaml/xapi/monitor_rrds.ml        Wed Feb 10 14:33:41 2010 +0000
+++ b/ocaml/xapi/monitor_rrds.ml        Wed Apr 07 16:56:10 2010 +0100
@@ -672,28 +672,30 @@
                  else
                    rrdi.rrd
                in
-               (* Check whether the memory ds has changed since last update *)
-               let last_values = Rrd.get_last_ds_values rrd 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:
                 *)
-               let changed = not (List.mem vm_uuid paused_vms) &&
+               if not (List.mem vm_uuid paused_vms) then begin
+                 (* Check whether the memory ds has changed since last update 
*)
+                 let last_values = Rrd.get_last_ds_values rrd in
+                 let changed = 
                        begin try
-                               let old_mem = List.assoc "memory" last_values in
-                               let cur_mem_ds = List.find (fun ds -> 
ds.ds_name = "memory") dss in
-                               let cur_mem = cur_mem_ds.ds_value in
-                               cur_mem <> old_mem
+                         let old_mem = List.assoc "memory" last_values in
+                         let cur_mem_ds = List.find (fun ds -> ds.ds_name = 
"memory") dss in
+                         let cur_mem = cur_mem_ds.ds_value in
+                         cur_mem <> old_mem
                        with _ -> true end in
-               if changed then
-                 dirty_memory := StringSet.add vm_uuid !dirty_memory;
-
-               (* Now update the rras/dss *)
-               Rrd.ds_update_named rrd timestamp 
-                 (List.map (fun ds -> 
(ds.ds_name,(ds.ds_value,ds.ds_pdp_transform_function))) dss);
-               rrdi.dss <- dss;
+                 if changed then
+                       dirty_memory := StringSet.add vm_uuid !dirty_memory;
+                 
+                 (* Now update the rras/dss *)
+                 Rrd.ds_update_named rrd timestamp 
+                         (List.map (fun ds -> 
(ds.ds_name,(ds.ds_value,ds.ds_pdp_transform_function))) dss);
+                 rrdi.dss <- dss;
+               end
              with
                | Not_found ->
                    debug "Creating fresh RRD for VM uuid=%s" vm_uuid;
1 file changed, 16 insertions(+), 14 deletions(-)
ocaml/xapi/monitor_rrds.ml |   30 ++++++++++++++++--------------


Attachment: xen-api.hg.patch
Description: Text Data

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.