# HG changeset patch
# User Jonathan Knowles <[email protected]>
# Date 1264782551 0
# Node ID a8a2db5d8db352fc4d5cb55621302ce883bfb0a0
# Parent  ba381a270aa44fb8536165e9703f1327f83e60b8
[CA-31705] Improves error handling within vm-memory-target-wait.

Pushes intermediate identifiers into nested scope and removes redundant 
comments.

Signed-off-by: Jonathan Knowles <[email protected]>

diff -r ba381a270aa4 -r a8a2db5d8db3 ocaml/xapi/xapi_vm_helpers.ml
--- a/ocaml/xapi/xapi_vm_helpers.ml     Fri Jan 29 16:26:28 2010 +0000
+++ b/ocaml/xapi/xapi_vm_helpers.ml     Fri Jan 29 16:29:11 2010 +0000
@@ -658,20 +658,20 @@
                        then raise (Api_errors.Server_error
                                (Api_errors.task_cancelled,
                                [Ref.string_of (Context.get_task_id 
__context)]));
-               (* Fetch up-to-date value of memory_actual via a hypercall to 
Xen. *)
                let domain_id = Helpers.domid_of_vm ~__context ~self in
-               let domain_info = Vmopshelpers.with_xc
-                       (fun xc -> Xc.domain_getinfo xc domain_id) in
-               let memory_actual_pages = Int64.of_nativeint
-                       domain_info.Xc.total_memory_pages in
-               let memory_actual_kib = Xc.pages_to_kib memory_actual_pages in
-               let memory_actual_bytes = Memory.bytes_of_kib memory_actual_kib 
in
-               (* Fetch up-to-date value of target from xenstore. *)
-               let memory_target_kib = Int64.of_string
-                       (Vmopshelpers.with_xs
-                               (fun xs -> xs.Xs.read
-                                       (xs.Xs.getdomainpath domain_id ^ 
"/memory/target"))) in
-               let memory_target_bytes = Memory.bytes_of_kib memory_target_kib 
in
+               let memory_actual_bytes =
+                       let domain_info = Vmopshelpers.with_xc
+                               (fun xc -> Xc.domain_getinfo xc domain_id) in
+                       let memory_actual_pages = Int64.of_nativeint
+                               domain_info.Xc.total_memory_pages in
+                       let memory_actual_kib = Xc.pages_to_kib 
memory_actual_pages in
+                       Memory.bytes_of_kib memory_actual_kib in
+               let memory_target_bytes =
+                       let memory_target_kib = Int64.of_string
+                               (Vmopshelpers.with_xs
+                                       (fun xs -> xs.Xs.read
+                                               (xs.Xs.getdomainpath domain_id 
^ "/memory/target"))) in
+                       Memory.bytes_of_kib memory_target_kib in
                let difference_bytes = Int64.abs
                        (Int64.sub memory_actual_bytes memory_target_bytes) in
                debug
1 file changed, 13 insertions(+), 13 deletions(-)
ocaml/xapi/xapi_vm_helpers.ml |   26 +++++++++++++-------------


# HG changeset patch
# User Jonathan Knowles <[email protected]>
# Date 1264782551 0
# Node ID a8a2db5d8db352fc4d5cb55621302ce883bfb0a0
# Parent  ba381a270aa44fb8536165e9703f1327f83e60b8
[CA-31705] Improves error handling within vm-memory-target-wait.

Pushes intermediate identifiers into nested scope and removes redundant comments.

Signed-off-by: Jonathan Knowles <[email protected]>

diff -r ba381a270aa4 -r a8a2db5d8db3 ocaml/xapi/xapi_vm_helpers.ml
--- a/ocaml/xapi/xapi_vm_helpers.ml	Fri Jan 29 16:26:28 2010 +0000
+++ b/ocaml/xapi/xapi_vm_helpers.ml	Fri Jan 29 16:29:11 2010 +0000
@@ -658,20 +658,20 @@
 			then raise (Api_errors.Server_error
 				(Api_errors.task_cancelled,
 				[Ref.string_of (Context.get_task_id __context)]));
-		(* Fetch up-to-date value of memory_actual via a hypercall to Xen. *)
 		let domain_id = Helpers.domid_of_vm ~__context ~self in
-		let domain_info = Vmopshelpers.with_xc
-			(fun xc -> Xc.domain_getinfo xc domain_id) in
-		let memory_actual_pages = Int64.of_nativeint
-			domain_info.Xc.total_memory_pages in
-		let memory_actual_kib = Xc.pages_to_kib memory_actual_pages in
-		let memory_actual_bytes = Memory.bytes_of_kib memory_actual_kib in
-		(* Fetch up-to-date value of target from xenstore. *)
-		let memory_target_kib = Int64.of_string
-			(Vmopshelpers.with_xs
-				(fun xs -> xs.Xs.read
-					(xs.Xs.getdomainpath domain_id ^ "/memory/target"))) in
-		let memory_target_bytes = Memory.bytes_of_kib memory_target_kib in
+		let memory_actual_bytes =
+			let domain_info = Vmopshelpers.with_xc
+				(fun xc -> Xc.domain_getinfo xc domain_id) in
+			let memory_actual_pages = Int64.of_nativeint
+				domain_info.Xc.total_memory_pages in
+			let memory_actual_kib = Xc.pages_to_kib memory_actual_pages in
+			Memory.bytes_of_kib memory_actual_kib in
+		let memory_target_bytes =
+			let memory_target_kib = Int64.of_string
+				(Vmopshelpers.with_xs
+					(fun xs -> xs.Xs.read
+						(xs.Xs.getdomainpath domain_id ^ "/memory/target"))) in
+			Memory.bytes_of_kib memory_target_kib in
 		let difference_bytes = Int64.abs
 			(Int64.sub memory_actual_bytes memory_target_bytes) in
 		debug
_______________________________________________
xen-api mailing list
[email protected]
http://lists.xensource.com/mailman/listinfo/xen-api

Reply via email to