WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

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

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH] fix glitch where VM_metrics.memory_actual sticks at 0
From: David Scott <dave.scott@xxxxxxxxxxxxx>
Date: Wed, 7 Apr 2010 16:56:37 +0100
Delivery-date: Wed, 07 Apr 2010 08:54:06 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
# 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
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-API] [PATCH] fix glitch where VM_metrics.memory_actual sticks at 0, David Scott <=