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] Always allow dom0 to be ballooned

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH] Always allow dom0 to be ballooned
From: David Scott <dave.scott@xxxxxxxxxxxxx>
Date: Wed, 3 Feb 2010 18:35:20 +0000
Delivery-date: Wed, 03 Feb 2010 10:28:03 -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 1265222077 0
# Node ID 0626509183504d757e9b77d8688307a20f039556
# Parent  e1d8b800b96520a64edf53d6c1c41b1eb88f13c3
CA-37257: Always allow dom0 to be ballooned even if we're trying to prevent 
domUs from being ballooned.

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

diff -r e1d8b800b965 -r 062650918350 ocaml/xapi/xapi_vm.ml
--- a/ocaml/xapi/xapi_vm.ml     Wed Feb 03 18:34:37 2010 +0000
+++ b/ocaml/xapi/xapi_vm.ml     Wed Feb 03 18:34:37 2010 +0000
@@ -140,7 +140,7 @@
                static_max = max;
        } in
        Vm_memory_constraints.assert_valid_for_current_context
-               ~__context ~constraints;
+               ~__context ~vm:self ~constraints;
        Db.VM.set_memory_static_min ~__context ~self ~value:min;
        Db.VM.set_memory_static_max ~__context ~self ~value:max;
        update_memory_overhead ~__context ~vm:self
@@ -171,7 +171,7 @@
                static_max  = static_max;
        } in
        Vm_memory_constraints.assert_valid_for_current_context
-               ~__context ~constraints;
+               ~__context ~vm:self ~constraints;
        Vm_memory_constraints.set ~__context ~vm_ref:self ~constraints;
        update_memory_overhead ~__context ~vm:self
 
diff -r e1d8b800b965 -r 062650918350 ocaml/xapi/xapi_vm_helpers.ml
--- a/ocaml/xapi/xapi_vm_helpers.ml     Wed Feb 03 18:34:37 2010 +0000
+++ b/ocaml/xapi/xapi_vm_helpers.ml     Wed Feb 03 18:34:37 2010 +0000
@@ -579,7 +579,7 @@
                target = min;
                dynamic_max = max } in
        Vm_memory_constraints.assert_valid_for_current_context
-               ~__context ~constraints;
+               ~__context ~vm:self ~constraints;
 
        (* memory_target is now unused but setting it equal *)
        (* to dynamic_min avoids tripping validation code.  *)
diff -r e1d8b800b965 -r 062650918350 ocaml/xapi/xapi_vm_memory_constraints.ml
--- a/ocaml/xapi/xapi_vm_memory_constraints.ml  Wed Feb 03 18:34:37 2010 +0000
+++ b/ocaml/xapi/xapi_vm_memory_constraints.ml  Wed Feb 03 18:34:37 2010 +0000
@@ -31,7 +31,7 @@
        (** Asserts that the given set of constraints [c] is valid for the 
current
            context. *)
        val assert_valid_for_current_context :
-               __context:Context.t -> constraints:t -> unit
+               __context:Context.t -> vm:API.ref_VM -> constraints:t -> unit
 
        (** Extracts memory constraints from the given VM record. *)
        val extract : vm_record:API.vM_t -> t
@@ -65,8 +65,10 @@
                                ["Memory limits must satisfy: \
                                static_min â?¤ dynamic_min = dynamic_max = 
static_max"]))
 
-       let assert_valid_for_current_context ~__context ~constraints =
-               (if Restrictions.context_ok_for_dmc ~__context
+       let assert_valid_for_current_context ~__context ~vm ~constraints =
+         (* NB we don't want to prevent dom0 ballooning even if we do want to 
prevent
+                domU ballooning. *)
+               (if Db.VM.get_is_control_domain ~__context ~self:vm || 
(Restrictions.context_ok_for_dmc ~__context)
                        then assert_valid
                        else assert_valid_and_pinned_at_static_max)
                ~constraints
3 files changed, 8 insertions(+), 6 deletions(-)
ocaml/xapi/xapi_vm.ml                    |    4 ++--
ocaml/xapi/xapi_vm_helpers.ml            |    2 +-
ocaml/xapi/xapi_vm_memory_constraints.ml |    8 +++++---


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] Always allow dom0 to be ballooned, David Scott <=