[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-API] [PATCH 3 of 4] CA-38567: Catch I/O errors during ?raw_vdi_import
# HG changeset patch # User Daniel Stodden <daniel.stodden@xxxxxxxxxx> # Date 1267831159 28800 # Node ID 9b5b9b509bcb55f6cd2b485191fa6af88862845c # Parent 19f971d3238714940e6ada4acf23a7ee7cb9558f CA-38567: Catch I/O errors during ?raw_vdi_import Signed-off-by: Daniel Stodden <daniel.stodden@xxxxxxxxxx> diff -r 19f971d32387 -r 9b5b9b509bcb ocaml/xapi/import_raw_vdi.ml --- a/ocaml/xapi/import_raw_vdi.ml Fri Mar 05 15:19:19 2010 -0800 +++ b/ocaml/xapi/import_raw_vdi.ml Fri Mar 05 15:19:19 2010 -0800 @@ -49,7 +49,13 @@ (fun device -> let fd = Unix.openfile device [ Unix.O_WRONLY ] 0 in finally - (fun () -> Unixext.copy_file ~limit:len s fd) + (fun () -> + try + Unixext.copy_file ~limit:len s fd; + Unixext.fsync fd + with Unix.Unix_error(Unix.EIO, _, _) -> + raise (Api_errors.Server_error (Api_errors.vdi_io_error, ["Device I/O errors"])) + ) (fun () -> Unix.close fd) ) ); # HG changeset patch # User Daniel Stodden <daniel.stodden@xxxxxxxxxx> # Date 1267831159 28800 # Node ID 9b5b9b509bcb55f6cd2b485191fa6af88862845c # Parent 19f971d3238714940e6ada4acf23a7ee7cb9558f CA-38567: Catch I/O errors during ?raw_vdi_import Signed-off-by: Daniel Stodden <daniel.stodden@xxxxxxxxxx> diff -r 19f971d32387 -r 9b5b9b509bcb ocaml/xapi/import_raw_vdi.ml --- a/ocaml/xapi/import_raw_vdi.ml Fri Mar 05 15:19:19 2010 -0800 +++ b/ocaml/xapi/import_raw_vdi.ml Fri Mar 05 15:19:19 2010 -0800 @@ -49,7 +49,13 @@ (fun device -> let fd = Unix.openfile device [ Unix.O_WRONLY ] 0 in finally - (fun () -> Unixext.copy_file ~limit:len s fd) + (fun () -> + try + Unixext.copy_file ~limit:len s fd; + Unixext.fsync fd + with Unix.Unix_error(Unix.EIO, _, _) -> + raise (Api_errors.Server_error (Api_errors.vdi_io_error, ["Device I/O errors"])) + ) (fun () -> Unix.close fd) ) ); _______________________________________________ xen-api mailing list xen-api@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/mailman/listinfo/xen-api
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |