# HG changeset patch
# User David Scott <[email protected]>
# Date 1259361889 0
# Node ID 099e85cfc1fee37b949f20ae56ff85125380a956
# Parent  b78334e85b36387b511281266fd2992c554f1842
[XIU]: write control/feature-balloon 3s after starting a simulated domain.

Signed-off-by: David Scott <[email protected]>

diff -r b78334e85b36 -r 099e85cfc1fe ocaml/xiu/xiu.ml
--- a/ocaml/xiu/xiu.ml  Fri Nov 27 22:44:48 2009 +0000
+++ b/ocaml/xiu/xiu.ml  Fri Nov 27 22:44:49 2009 +0000
@@ -426,6 +426,11 @@
                in
 
        with_xs_retry (fun xs ->
+               (* booting *)
+               Thread.delay 3.;
+               
+               let written_feature_balloon = ref false in
+
                (* install watches *)
                xs.Xs.watch (mypath ^ "control/shutdown") "control";
                xs.Xs.watch (mypath ^ "device") "device";
@@ -446,7 +451,17 @@
                                | "backend" -> backend_changed xs w
                                | "device"  -> device_changed xs w
                                | "control" -> control_changed xs w
-                               | "balloon" -> read_memory_target xs domid
+                               | "balloon" -> 
+                                         (* NB normally the domain builder + 
qemu would allocate memory during boot, then
+                                                the PV drivers would write 
feature-balloon and then we would sample the 
+                                                memory-offset. In the 
simulator there is no domain builder and the first time
+                                                the memory/target watch fires 
is when we allocate all the memory.
+                                                Make sure we allocate the 
memory before writing feature-balloon: *)
+                                         read_memory_target xs domid;
+                                         if not !written_feature_balloon then 
begin
+                                               xs.Xs.write (mypath ^ 
"control/feature-balloon") "true";
+                                               written_feature_balloon := true
+                                         end;
                                | _         -> add_console (sprintf "dom0: 
unknown watch %s,%s" w v);
                                end;
                                match !shutdowning with
1 file changed, 16 insertions(+), 1 deletion(-)
ocaml/xiu/xiu.ml |   17 ++++++++++++++++-


# HG changeset patch
# User David Scott <[email protected]>
# Date 1259361889 0
# Node ID 099e85cfc1fee37b949f20ae56ff85125380a956
# Parent  b78334e85b36387b511281266fd2992c554f1842
[XIU]: write control/feature-balloon 3s after starting a simulated domain.

Signed-off-by: David Scott <[email protected]>

diff -r b78334e85b36 -r 099e85cfc1fe ocaml/xiu/xiu.ml
--- a/ocaml/xiu/xiu.ml	Fri Nov 27 22:44:48 2009 +0000
+++ b/ocaml/xiu/xiu.ml	Fri Nov 27 22:44:49 2009 +0000
@@ -426,6 +426,11 @@
 		in
 
 	with_xs_retry (fun xs ->
+		(* booting *)
+		Thread.delay 3.;
+		
+		let written_feature_balloon = ref false in
+
 		(* install watches *)
 		xs.Xs.watch (mypath ^ "control/shutdown") "control";
 		xs.Xs.watch (mypath ^ "device") "device";
@@ -446,7 +451,17 @@
 				| "backend" -> backend_changed xs w
 				| "device"  -> device_changed xs w
 				| "control" -> control_changed xs w
-				| "balloon" -> read_memory_target xs domid
+				| "balloon" -> 
+					  (* NB normally the domain builder + qemu would allocate memory during boot, then
+						 the PV drivers would write feature-balloon and then we would sample the 
+						 memory-offset. In the simulator there is no domain builder and the first time
+						 the memory/target watch fires is when we allocate all the memory.
+						 Make sure we allocate the memory before writing feature-balloon: *)
+					  read_memory_target xs domid;
+					  if not !written_feature_balloon then begin
+						xs.Xs.write (mypath ^ "control/feature-balloon") "true";
+						written_feature_balloon := true
+					  end;
 				| _         -> add_console (sprintf "dom0: unknown watch %s,%s" w v);
 				end;
 				match !shutdowning with
_______________________________________________
xen-api mailing list
[email protected]
http://lists.xensource.com/mailman/listinfo/xen-api

Reply via email to