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 1 of 7] [XIU]: store the physical memory used/free in K

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH 1 of 7] [XIU]: store the physical memory used/free in KiB rather than MiB for consistency
From: David Scott <dave.scott@xxxxxxxxxxxxx>
Date: Fri, 27 Nov 2009 22:47:26 +0000
Delivery-date: Fri, 27 Nov 2009 14:46:43 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1259362045@xxxxxxxxxxxxxxxxxxxx>
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 1259361886 0
# Node ID 9b40d09867ba38225562945a9fe4f043757e6f8f
# Parent  6812f542cd3e249e0fce285a0f803bc99de52da0
[XIU]: store the physical memory used/free in KiB rather than MiB for 
consistency.

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

diff -r 6812f542cd3e -r 9b40d09867ba ocaml/xiu/xiu.ml
--- a/ocaml/xiu/xiu.ml  Thu Nov 26 17:47:10 2009 +0000
+++ b/ocaml/xiu/xiu.ml  Fri Nov 27 22:44:46 2009 +0000
@@ -33,8 +33,8 @@
 let nb_cpu_threads = ref 1
 let cpu_usage = ref 1000L
 let cpu_speed_mhz = ref (1 * 1000) (* by default 1 ghz *)
-let physical_free_mb = ref (4 * 1024 - 1) (* by default ~4gb of free memory *)
-let physical_memory_mb = ref (4 * 1024) (* by default 4gb of memory *)
+let physical_free_kib = ref ((4 * 1024 - 1) * 1024) (* by default ~4gb of free 
memory *)
+let physical_memory_kib = ref (4 * 1024 * 1024) (* by default 4gb of memory *)
 
 (** utility *)
 let create_unix_socket name =
@@ -618,11 +618,11 @@
                        -einval
                in
        let do_xc_sysctl _cmd args =
+         let pages_of_kb n = n / 4 in
                let cmd = sysctl_of_int (int_of_string _cmd) in
                match cmd, args with
                | Sysctl_getdomaininfolist, [first; max] ->
                        let first = int_of_string first and max = int_of_string 
max in
-                       let pages_of_kb n = n / 4 in
                        hypercall_debug2 (sprintf "get domain info list 
(%d,%d)" first (first + max));
                        let domains = domain_list_from first max in
                        let num = List.length domains in
@@ -642,14 +642,13 @@
                        0
                | Sysctl_physinfo, _ ->
                        hypercall_debug2 (sprintf "physinfo");
-                       let pages_of_mb n = n * (4096 / 4) in
                        marshall_multiple fd [ string_of_int !nb_cpu_threads;
                                               string_of_int !nb_cpu_cores;
                                               string_of_int !nb_cpu_sockets;
                                               string_of_int !nb_cpu_nodes;
                                               string_of_int (!cpu_speed_mhz * 
1000);
-                                              string_of_int (pages_of_mb 
!physical_memory_mb);
-                                              string_of_int (pages_of_mb 
!physical_free_mb); ];
+                                              string_of_int (pages_of_kb 
!physical_memory_kib);
+                                              string_of_int (pages_of_kb 
!physical_free_kib); ];
                        0
                | Sysctl_getcpuinfo, [m] ->
                        let nbcpu = min (int_of_string m) 2 in
@@ -791,8 +790,8 @@
                        | "error-create" -> inject_error := Inject_error_create 
:: !inject_error
                        | "shutdown" -> inject_error := Inject_shutdown :: 
!inject_error
                        | _ -> ());
-               "free-memory", Config.Set_int physical_free_mb;
-               "total-memory", Config.Set_int physical_memory_mb;
+               "free-memory", Config.Set_int physical_free_kib;
+               "total-memory", Config.Set_int physical_memory_kib;
                "cpu-nodes", Config.Set_int nb_cpu_nodes;
                "cpu-sockets", Config.Set_int nb_cpu_sockets;
                "cpu-cores", Config.Set_int nb_cpu_cores;
1 file changed, 7 insertions(+), 8 deletions(-)
ocaml/xiu/xiu.ml |   15 +++++++--------


Attachment: xen-api.hg-7.patch
Description: Text Data

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api