# HG changeset patch
# User David Scott <[email protected]>
# Date 1271932039 -3600
# Node ID 172736b1710a836c01fe4511567942d5caebcfff
# Parent  66b40631f2b28df6cd73a74733249c7af0212214
CA-40390: even if VDI.destroy fails after a VM.resume, log the error and 
continue. Leaking a VDI is unfortunate but leaking a whole domain is worse.

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

diff -r 66b40631f2b2 -r 172736b1710a ocaml/xapi/vmops.ml
--- a/ocaml/xapi/vmops.ml       Tue Apr 20 19:18:53 2010 +0100
+++ b/ocaml/xapi/vmops.ml       Thu Apr 22 11:27:19 2010 +0100
@@ -808,9 +808,15 @@
              (fun () -> Helpers.log_exn_continue "restore" (fun () -> 
Unix.close fd) ()));
        
        (* No exception must have happened: safe to destroy the VDI *)
-       Helpers.call_api_functions ~__context
-          (fun rpc session_id ->
-             Client.VDI.destroy rpc session_id suspend_vdi);
+          begin 
+                try
+                  Helpers.call_api_functions ~__context
+                          (fun rpc session_id ->
+                                       Client.VDI.destroy rpc session_id 
suspend_vdi)
+                with _ ->
+                        (* This should never happen but just in case, we log 
prominently and continue *)
+                        error "Failed to delete suspend image VDI: %s" 
(Db.VDI.get_uuid ~__context ~self:suspend_vdi);
+          end;
        Db.VM.set_suspend_VDI ~__context ~self ~value:Ref.null;
 
           Db.VM.set_domid ~__context ~self ~value:(Int64.of_int domid);
1 file changed, 9 insertions(+), 3 deletions(-)
ocaml/xapi/vmops.ml |   12 +++++++++---


# HG changeset patch
# User David Scott <[email protected]>
# Date 1271932039 -3600
# Node ID 172736b1710a836c01fe4511567942d5caebcfff
# Parent  66b40631f2b28df6cd73a74733249c7af0212214
CA-40390: even if VDI.destroy fails after a VM.resume, log the error and continue. Leaking a VDI is unfortunate but leaking a whole domain is worse.

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

diff -r 66b40631f2b2 -r 172736b1710a ocaml/xapi/vmops.ml
--- a/ocaml/xapi/vmops.ml	Tue Apr 20 19:18:53 2010 +0100
+++ b/ocaml/xapi/vmops.ml	Thu Apr 22 11:27:19 2010 +0100
@@ -808,9 +808,15 @@
 	      (fun () -> Helpers.log_exn_continue "restore" (fun () -> Unix.close fd) ()));
        
        (* No exception must have happened: safe to destroy the VDI *)
-       Helpers.call_api_functions ~__context
-	   (fun rpc session_id ->
-	      Client.VDI.destroy rpc session_id suspend_vdi);
+	   begin 
+		 try
+		   Helpers.call_api_functions ~__context
+			   (fun rpc session_id ->
+					Client.VDI.destroy rpc session_id suspend_vdi)
+		 with _ ->
+			 (* This should never happen but just in case, we log prominently and continue *)
+			 error "Failed to delete suspend image VDI: %s" (Db.VDI.get_uuid ~__context ~self:suspend_vdi);
+	   end;
        Db.VM.set_suspend_VDI ~__context ~self ~value:Ref.null;
 
 	   Db.VM.set_domid ~__context ~self ~value:(Int64.of_int domid);
_______________________________________________
xen-api mailing list
[email protected]
http://lists.xensource.com/mailman/listinfo/xen-api

Reply via email to