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

[Xen-API] [PATCH] Prevent the ballooning daemon from setting a bad initial balloon target



# HG changeset patch
# User David Scott <dave.scott@xxxxxxxxxxxxx>
# Date 1259589197 0
# Node ID 9e26e414cead7308a9d746f3028a69ae8cf5dc94
# Parent  87733f43712b5e3653d0651f10e34b9634f79c27
CA-35406: refrain from setting a domain's target unless we think it 
'can_balloon' ie it has exposed feature-balloon.

This fixes the problem generated by the following interleaving:

xapi                                squeezed
--------------------------------------------------------------------------
reserve required memory + overhead
create domain
invoke domain builder
                                    observes domain with no feature-balloon
                                    sets maxmem = requred memory + overhead
                                    sets target = maxmem [1]

unpauses domain

                                    observes feature-balloon
                                    sets memory-offset = -overhead (!)
                                    declares domain uncooperative


[1] 519:f509339c8f74 avoid setting target > maxmem

diff -r 87733f43712b -r 9e26e414cead ocaml/xenops/squeeze_xen.ml
--- a/ocaml/xenops/squeeze_xen.ml       Mon Nov 30 13:53:14 2009 +0000
+++ b/ocaml/xenops/squeeze_xen.ml       Mon Nov 30 13:53:17 2009 +0000
@@ -371,11 +371,18 @@
                then failwith "Proposed target is negative (domid %d): %Ld" 
domid target_kib;
                let cnx = (xc, xs) in
                let memory_max_kib = Domain.get_maxmem cnx domid in
+               (* We only set the target of a domain if it has exposed 
feature-balloon: otherwise
+                  we can screw up the memory-offset calculations for 
partially-built domains. *)
+               let can_balloon = Domain.get_feature_balloon cnx domid in
                if target_kib > memory_max_kib then begin
                  Domain.set_maxmem_noexn cnx domid target_kib;
-                 Domain.set_target_noexn cnx domid target_kib;
+                 if can_balloon
+                 then Domain.set_target_noexn cnx domid target_kib
+                 else debug "Not setting target for domid: %d since no 
feature-balloon. Setting maxmem to %Ld" domid target_kib;
                end else begin
-                 Domain.set_target_noexn cnx domid target_kib;
+                 if can_balloon
+                 then Domain.set_target_noexn cnx domid target_kib
+                 else debug "Not setting target for domid: %d since no 
feature-balloon. Setting maxmem to %Ld" domid target_kib;
                  Domain.set_maxmem_noexn cnx domid target_kib;
                end
        with e ->
1 file changed, 9 insertions(+), 2 deletions(-)
ocaml/xenops/squeeze_xen.ml |   11 +++++++++--


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