Skip to contentSkip to conversation

CA-38567: Catch I/O errors during VM.suspend

PATCH New Daniel Stodden 1 participant 2 messages Mar 16, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 CA-38567: Catch I/O errors during VM.suspend

Hi.

Yet another fd we'd rather like to sync down before closing.

Apologies if you receive this patch twice, but yesterday's apparently didn't make it through.

Beware: Proposed patch adjusts exception handling in VM.checkpoint. The previous version only did that for ENOSPC, the new one would just pass through any known Api_error. This maybe wants some additional review. Used to be Thomas's:

user:        Thomas Gazagnaire <[email protected]>
summary:     CA-32738: improve the error message on checkpoint when there is not enough space to create the suspend image.

Thanks.

Daniel

#1 lore raw

PATCH 1/1 CA-38567: Catch I/O errors during VM.suspend

# HG changeset patch
# User Daniel Stodden <[email protected]> # Date 1268753645 0
# Node ID 9a2390fece52d39d860247756a0ce300615fb209 # Parent 86257cf86017409b3c7e268f6950a6323bcdece7
CA-38567: Catch I/O errors during VM.suspend

ocaml/xapi/vmops.ml +7 -1
diff -r 86257cf86017 -r 9a2390fece52 ocaml/xapi/vmops.ml
@@ -960,7 +960,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");
 
 			debug "suspend phase 4/4: recording memory usage";
ocaml/xapi/xapi_vm_snapshot.ml +1 -3
diff -r 86257cf86017 -r 9a2390fece52 ocaml/xapi/xapi_vm_snapshot.ml
@@ -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-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel