# HG changeset patch
# User Daniel Stodden <[email protected]>
# Date 1268644943 0
# Node ID 7c2e5719936e6e4af4a3a0061518ebd622f4bb22
# Parent  d455f3c74966447903add709174b57c8c50cc511
CA-38567: Catch I/O errors during VM.suspend

Signed-off-by: Daniel Stodden <[email protected]>

diff -r d455f3c74966 -r 7c2e5719936e ocaml/xapi/vmops.ml
--- a/ocaml/xapi/vmops.ml       Fri Mar 12 15:19:41 2010 +0000
+++ b/ocaml/xapi/vmops.ml       Mon Mar 15 09:22:23 2010 +0000
@@ -925,7 +925,13 @@
                                                        Db.VM.set_suspend_VDI 
~__context ~self:vm
                                                                ~value:vdi_ref;
                                                )
-                                               (fun () -> Unix.close fd);
+                                               (fun () ->
+                                                  try
+                                                    Unixext.fsync fd;
+                                                    Unix.close fd
+                                                  with 
Unix.Unix_error(Unix.EIO, _, _) ->
+                                                    raise 
(Api_errors.Server_error (Api_errors.vdi_io_error, ["I/O error saving VM 
suspend image"]))
+                                               );
                        debug "suspend: complete")
                )
 
diff -r d455f3c74966 -r 7c2e5719936e ocaml/xapi/xapi_vm_snapshot.ml
--- a/ocaml/xapi/xapi_vm_snapshot.ml    Fri Mar 12 15:19:41 2010 +0000
+++ b/ocaml/xapi/xapi_vm_snapshot.ml    Mon Mar 15 09:22:23 2010 +0000
@@ -186,9 +186,7 @@
                                (* flush the devices *)
                                List.iter (Xapi_vbd.flush ~__context) vbds;
                        with
-                               | 
Api_errors.Server_error("SR_BACKEND_FAILURE_44", _) as e ->
-                                       error "Not enough space to create the 
suspend image";
-                                       raise e
+                               | Api_errors.Server_error(_, _) as e -> raise e
                                | _ -> raise (Api_errors.Server_error 
(Api_errors.vm_checkpoint_suspend_failed, [Ref.string_of vm]))
                end;
 
# HG changeset patch
# User Daniel Stodden <[email protected]>
# Date 1268644943 0
# Node ID 7c2e5719936e6e4af4a3a0061518ebd622f4bb22
# Parent  d455f3c74966447903add709174b57c8c50cc511
CA-38567: Catch I/O errors during VM.suspend

Signed-off-by: Daniel Stodden <[email protected]>

diff -r d455f3c74966 -r 7c2e5719936e ocaml/xapi/vmops.ml
--- a/ocaml/xapi/vmops.ml	Fri Mar 12 15:19:41 2010 +0000
+++ b/ocaml/xapi/vmops.ml	Mon Mar 15 09:22:23 2010 +0000
@@ -925,7 +925,13 @@
 							Db.VM.set_suspend_VDI ~__context ~self:vm
 								~value:vdi_ref;
 						)
-						(fun () -> Unix.close fd);
+						(fun () ->
+						   try
+						     Unixext.fsync fd;
+						     Unix.close fd
+						   with Unix.Unix_error(Unix.EIO, _, _) ->
+						     raise (Api_errors.Server_error (Api_errors.vdi_io_error, ["I/O error saving VM suspend image"]))
+						);
 			debug "suspend: complete")
 		)
 
diff -r d455f3c74966 -r 7c2e5719936e ocaml/xapi/xapi_vm_snapshot.ml
--- a/ocaml/xapi/xapi_vm_snapshot.ml	Fri Mar 12 15:19:41 2010 +0000
+++ b/ocaml/xapi/xapi_vm_snapshot.ml	Mon Mar 15 09:22:23 2010 +0000
@@ -186,9 +186,7 @@
 				(* flush the devices *)
 				List.iter (Xapi_vbd.flush ~__context) vbds;
 			with
-				| Api_errors.Server_error("SR_BACKEND_FAILURE_44", _) as e ->
-					error "Not enough space to create the suspend image";
-					raise e
+				| Api_errors.Server_error(_, _) as e -> raise e
 				| _ -> raise (Api_errors.Server_error (Api_errors.vm_checkpoint_suspend_failed, [Ref.string_of vm]))
 		end;
 
_______________________________________________
xen-api mailing list
[email protected]
http://lists.xensource.com/mailman/listinfo/xen-api

Reply via email to