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] Prevent the ballooning daemon from setting a bad initi

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH] Prevent the ballooning daemon from setting a bad initial balloon target
From: David Scott <dave.scott@xxxxxxxxxxxxx>
Date: Mon, 30 Nov 2009 13:54:50 +0000
Delivery-date: Mon, 30 Nov 2009 05:50:12 -0800
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 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
<Prev in Thread] Current Thread [Next in Thread>