[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-API] [PATCH 3 of 8] [CA-31705] Improves error handling within vm-memory-target-wait



# HG changeset patch
# User Jonathan Knowles <jonathan.knowles@xxxxxxxxxxxxx>
# 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 <jonathan.knowles@xxxxxxxxxxxxx>

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 +++++++++++++-------------


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

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.