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

[Xen-API] [PATCH] [CA-34383] Ignore updates to memory metrics originating from paused domains



# HG changeset patch
# User Jonathan Knowles <jonathan.knowles@xxxxxxxxxxxxx>
# Date 1266331473 0
# Node ID 8ba058e6fc217b2347d2ac5ffe3607d6181e81a0
# Parent  afb8db20d991aadbe5dc0ec908f5fa3f66059e5b
[CA-34383] Ignore updates to memory metrics originating from paused domains.
Memory metrics updates from paused domains appear to serve no useful purpose.
Moreover, such updates can actually cause undesirable discontinuities in the
observed values of memory_actual during VM migrate operations.

Signed-off-by: Jonathan Knowles <jonathan.knowles@xxxxxxxxxxxxx>
Acked-by: Jonathan Ludlam <Jonathan.Ludlam@xxxxxxxxxxxxx>

diff -r afb8db20d991 -r 8ba058e6fc21 ocaml/xapi/monitor.ml
--- a/ocaml/xapi/monitor.ml     Fri Feb 12 12:42:04 2010 +0000
+++ b/ocaml/xapi/monitor.ml     Tue Feb 16 14:44:33 2010 +0000
@@ -436,6 +436,11 @@
          let domains = Xc.domain_getinfolist xc 0 in
       let timestamp = Unix.gettimeofday() in
       let my_rebooting_vms = StringSet.fold (fun uuid acc -> uuid::acc) 
!rebooting_vms [] in
+                       let uuid_of_domain d =
+                               Uuid.to_string (Uuid.uuid_of_int_array 
(d.Xc.handle)) in
+                       let domain_paused d = d.Xc.paused in
+                       let my_paused_domain_uuids =
+                               List.map uuid_of_domain (List.filter 
domain_paused domains) in
       let (vifs,pifs) = try update_netdev domains with e -> (debug "Exception 
in update_netdev(). Defaulting value for vifs/pifs: %s" (Printexc.to_string e); 
([],[]))  in
       let (vcpus,uuids,domids) = update_vcpus xc domains in
       Xapi_guest_agent.sync_cache domids;
@@ -450,7 +455,7 @@
        handle_exn "update_pcpus" (fun ()->update_pcpus xc) [];
        handle_exn "update_vbds" (fun ()->update_vbds domains) [];
        handle_exn "update_loadavg" (fun ()-> [ update_loadavg () ]) [];
-       handle_exn "update_memory" (fun ()->update_memory __context xc domains) 
[]],uuids,pifs,timestamp,my_rebooting_vms)
+       handle_exn "update_memory" (fun ()->update_memory __context xc domains) 
[]],uuids,pifs,timestamp,my_rebooting_vms, my_paused_domain_uuids)
     )
   )
 
@@ -458,9 +463,9 @@
 let do_monitor __context xc =
   Stats.time_this "monitor"
     (fun () ->
-      let (stats,uuids,pifs,timestamp,my_rebooting_vms) = read_all_dom0_stats 
__context in
+      let (stats,uuids,pifs,timestamp,my_rebooting_vms,my_paused_vms) = 
read_all_dom0_stats __context in
       Monitor_self.go __context;
-      Monitor_rrds.update_rrds ~__context timestamp stats uuids pifs 
my_rebooting_vms)
+      Monitor_rrds.update_rrds ~__context timestamp stats uuids pifs 
my_rebooting_vms my_paused_vms)
     
 let _loop __context xc =
   while true
diff -r afb8db20d991 -r 8ba058e6fc21 ocaml/xapi/monitor_rrds.ml
--- a/ocaml/xapi/monitor_rrds.ml        Fri Feb 12 12:42:04 2010 +0000
+++ b/ocaml/xapi/monitor_rrds.ml        Tue Feb 16 14:44:33 2010 +0000
@@ -600,7 +600,7 @@
  * domain has gone and we stream the RRD to the master. We also have a
  * list of the currently rebooting VMs to ensure we don't accidentally
  * archive the RRD *)
-let update_rrds ~__context timestamp dss uuids pifs rebooting_vms =
+let update_rrds ~__context timestamp dss uuids pifs rebooting_vms paused_vms =
   (* Here we do the synchronising between the dom0 view of the world
      and our Hashtbl. By the end of this execute block, the Hashtbl
      correctly represents the world *)
@@ -653,14 +653,19 @@
                in
                (* Check whether the memory ds has changed since last update *)
                let last_values = Rrd.get_last_ds_values rrd in
-               let changed = 
-                 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
-                 with _ -> true
-               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) &&
+                       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
+                       with _ -> true end in
                if changed then
                  dirty_memory := StringSet.add vm_uuid !dirty_memory;
 
2 files changed, 22 insertions(+), 12 deletions(-)
ocaml/xapi/monitor.ml      |   11 ++++++++---
ocaml/xapi/monitor_rrds.ml |   23 ++++++++++++++---------


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®.