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 08 of 12] [PCR0047] Replaces inline memory constraint v

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH 08 of 12] [PCR0047] Replaces inline memory constraint validation code with calls to function "VM_memory_constraints.assert_valid_for_current_context"
From: Jonathan Knowles <jonathan.knowles@xxxxxxxxxxxxx>
Date: Mon, 1 Feb 2010 16:32:10 +0000
Delivery-date: Mon, 01 Feb 2010 08:37:03 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1265041922@radon>
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 Jonathan Knowles <jonathan.knowles@xxxxxxxxxxxxx>
# Date 1265039944 0
# Node ID 79d00bde5fb4f7c1b175b52ff99c7830c6cd437f
# Parent  5de74d499b798f5029454ae8c630b1525037cf08
[PCR0047] Replaces inline memory constraint validation code with calls to 
function "VM_memory_constraints.assert_valid_for_current_context".

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

diff -r 5de74d499b79 -r 79d00bde5fb4 ocaml/xapi/xapi_vm.ml
--- a/ocaml/xapi/xapi_vm.ml     Mon Feb 01 15:59:04 2010 +0000
+++ b/ocaml/xapi/xapi_vm.ml     Mon Feb 01 15:59:04 2010 +0000
@@ -139,10 +139,8 @@
                static_min = min;
                static_max = max;
        } in
-       if not (Vm_memory_constraints.are_valid ~constraints)
-       then raise (
-               Api_errors.Server_error (
-                       Api_errors.memory_constraint_violation, ["min or 
max"]));
+       Vm_memory_constraints.assert_valid_for_current_context
+               ~__context ~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
@@ -172,11 +170,8 @@
                dynamic_max = dynamic_max;
                static_max  = static_max;
        } in
-       if not (Vm_memory_constraints.are_valid ~constraints)
-       then raise (Api_errors.Server_error (
-               Api_errors.memory_constraint_violation,
-               ["Memory limits must be in valid order: \
-               static_min â?¤ dynamic_min â?¤ dynamic_max â?¤ static_max"]));
+       Vm_memory_constraints.assert_valid_for_current_context
+               ~__context ~constraints;
        Vm_memory_constraints.set ~__context ~vm_ref:self ~constraints;
        update_memory_overhead ~__context ~vm:self
 
diff -r 5de74d499b79 -r 79d00bde5fb4 ocaml/xapi/xapi_vm_helpers.ml
--- a/ocaml/xapi/xapi_vm_helpers.ml     Mon Feb 01 15:59:04 2010 +0000
+++ b/ocaml/xapi/xapi_vm_helpers.ml     Mon Feb 01 15:59:04 2010 +0000
@@ -578,9 +578,8 @@
                dynamic_min = min;
                target = min;
                dynamic_max = max } in
-       if not (Vm_memory_constraints.are_valid ~constraints)
-       then raise 
(Api_errors.Server_error(Api_errors.memory_constraint_violation,
-               ["min or max"]));
+       Vm_memory_constraints.assert_valid_for_current_context
+               ~__context ~constraints;
 
        (* memory_target is now unused but setting it equal *)
        (* to dynamic_min avoids tripping validation code.  *)
2 files changed, 6 insertions(+), 12 deletions(-)
ocaml/xapi/xapi_vm.ml         |   13 ++++---------
ocaml/xapi/xapi_vm_helpers.ml |    5 ++---


Attachment: xen-api.hg-12.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>