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/
Home Products Support Community News


[Xen-API] [PATCH 2 of 8] [CA-39589] After a VM suspend operation, Xapi n

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH 2 of 8] [CA-39589] After a VM suspend operation, Xapi now reverses any destructive update it makes to XenStore's copy of dynamic-max
From: Jonathan Knowles <jonathan.knowles@xxxxxxxxxxxxx>
Date: Mon, 29 Mar 2010 11:53:41 +0100
Delivery-date: Mon, 29 Mar 2010 03:55:08 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1269860019@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 1269859680 -3600
# Node ID 4a9675ecf42df55895f201e2e7928d4ff0c6fc7f
# Parent  56f91be468e5704a0d7b0e7b7c5e2481b46aa12f
[CA-39589] After a VM suspend operation, Xapi now reverses any destructive 
update it makes to XenStore's copy of dynamic-max.

This changeset replaces a "try x catch y" expression with a "finally x y" 

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

diff -r 56f91be468e5 -r 4a9675ecf42d ocaml/xapi/vmops.ml
--- a/ocaml/xapi/vmops.ml       Mon Mar 29 11:47:59 2010 +0100
+++ b/ocaml/xapi/vmops.ml       Mon Mar 29 11:48:00 2010 +0100
@@ -904,7 +904,7 @@
                                        let max = Db.VM.get_memory_dynamic_max 
~__context ~self:vm in
                                        let min = Int64.to_int (Int64.div min 
1024L) in
                                        let max = Int64.to_int (Int64.div max 
1024L) in
-                                       try
+                                       finally (fun () ->
                                                (* Balloon down the guest as 
far as we can to force it to clear unnecessary caches etc. *)
                                                debug "suspend phase 0/4: 
asking guest to balloon down";
~xs ~min ~max:min domid;
@@ -960,13 +960,12 @@
                                                let final_memory_bytes = 
Memory.bytes_of_pages (Int64.of_nativeint di.Xc.total_memory_pages) in
                                                debug "total_memory_pages=%Ld; 
storing target=%Ld" (Int64.of_nativeint di.Xc.total_memory_pages) 
                                                (* CA-31759: avoid using the 
LBR to simplify upgrade *)
-                                               Db.VM.set_memory_target 
~__context ~self:vm ~value:final_memory_bytes;
-                                       with e ->
+                                               Db.VM.set_memory_target 
~__context ~self:vm ~value:final_memory_bytes;)
+                                       (fun () ->
~xs ~min ~max domid;
~__context ~xc ~xs;
                                                if is_paused then
-                                                       (try Domain.pause ~xc 
domid with _ -> ());
-                                               raise e))
+                                                       (try Domain.pause ~xc 
domid with _ -> ()))))
 let resume ~__context ~xc ~xs ~vm =
        let domid = Helpers.domid_of_vm ~__context ~self:vm in
1 file changed, 4 insertions(+), 5 deletions(-)
ocaml/xapi/vmops.ml |    9 ++++-----

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

xen-api mailing list