[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-API] [PATCH 1 of 4] CA-38567: Catch I/O errors during VDI import
# HG changeset patch # User Daniel Stodden <daniel.stodden@xxxxxxxxxx> # Date 1267831158 28800 # Node ID 04f7f3dde50d56896814e9568e7c3d43d8d9bde7 # Parent 1d2ea496a8f4aa0a2abfc2575a918403c3e9c172 CA-38567: Catch I/O errors during VDI import. Signed-off-by: Daniel Stodden <daniel.stodden@xxxxxxxxxx> diff -r 1d2ea496a8f4 -r 04f7f3dde50d ocaml/idl/api_errors.ml --- a/ocaml/idl/api_errors.ml Tue Mar 02 12:19:09 2010 +0000 +++ b/ocaml/idl/api_errors.ml Fri Mar 05 15:19:18 2010 -0800 @@ -172,6 +172,7 @@ let vdi_missing = "VDI_MISSING" let vdi_incompatible_type = "VDI_INCOMPATIBLE_TYPE" let vdi_not_managed = "VDI_NOT_MANAGED" +let vdi_io_error = "VDI_IO_ERROR" let cannot_create_state_file = "CANNOT_CREATE_STATE_FILE" diff -r 1d2ea496a8f4 -r 04f7f3dde50d ocaml/xapi/stream_vdi.ml --- a/ocaml/xapi/stream_vdi.ml Tue Mar 02 12:19:09 2010 +0000 +++ b/ocaml/xapi/stream_vdi.ml Fri Mar 05 15:19:18 2010 -0800 @@ -264,8 +264,13 @@ stream_from suffix (Int64.add skipped_size (Int64.add offset length)) end in - stream_from "-1" 0L) in - for_each_vdi __context (recv_one ifd __context) prefix_vdis; + stream_from "-1" 0L; + Unixext.fsync ofd) in + begin try + for_each_vdi __context (recv_one ifd __context) prefix_vdis; + with Unix.Unix_error(Unix.EIO, _, _) -> + raise (Api_errors.Server_error (Api_errors.vdi_io_error, ["Device I/O error"])) + end; !checksum_table @@ -313,8 +318,13 @@ were cancelled... *) TaskHelper.exn_if_cancelling ~__context; () in - stream_from "") in - for_each_vdi __context (recv_one ifd __context) prefix_vdis; + stream_from ""; + Unixext.fsync ofd) in + begin try + for_each_vdi __context (recv_one ifd __context) prefix_vdis; + with Unix.Unix_error(Unix.EIO, _, _) -> + raise (Api_errors.Server_error (Api_errors.vdi_io_error, ["Device I/O error"])) + end; if !hdr <> None then begin error "Failed to import XVA; some chunks were not processed."; raise (Failure "Some XVA data not processed") # HG changeset patch # User Daniel Stodden <daniel.stodden@xxxxxxxxxx> # Date 1267831158 28800 # Node ID 04f7f3dde50d56896814e9568e7c3d43d8d9bde7 # Parent 1d2ea496a8f4aa0a2abfc2575a918403c3e9c172 CA-38567: Catch I/O errors during VDI import. Signed-off-by: Daniel Stodden <daniel.stodden@xxxxxxxxxx> diff -r 1d2ea496a8f4 -r 04f7f3dde50d ocaml/idl/api_errors.ml --- a/ocaml/idl/api_errors.ml Tue Mar 02 12:19:09 2010 +0000 +++ b/ocaml/idl/api_errors.ml Fri Mar 05 15:19:18 2010 -0800 @@ -172,6 +172,7 @@ let vdi_missing = "VDI_MISSING" let vdi_incompatible_type = "VDI_INCOMPATIBLE_TYPE" let vdi_not_managed = "VDI_NOT_MANAGED" +let vdi_io_error = "VDI_IO_ERROR" let cannot_create_state_file = "CANNOT_CREATE_STATE_FILE" diff -r 1d2ea496a8f4 -r 04f7f3dde50d ocaml/xapi/stream_vdi.ml --- a/ocaml/xapi/stream_vdi.ml Tue Mar 02 12:19:09 2010 +0000 +++ b/ocaml/xapi/stream_vdi.ml Fri Mar 05 15:19:18 2010 -0800 @@ -264,8 +264,13 @@ stream_from suffix (Int64.add skipped_size (Int64.add offset length)) end in - stream_from "-1" 0L) in - for_each_vdi __context (recv_one ifd __context) prefix_vdis; + stream_from "-1" 0L; + Unixext.fsync ofd) in + begin try + for_each_vdi __context (recv_one ifd __context) prefix_vdis; + with Unix.Unix_error(Unix.EIO, _, _) -> + raise (Api_errors.Server_error (Api_errors.vdi_io_error, ["Device I/O error"])) + end; !checksum_table @@ -313,8 +318,13 @@ were cancelled... *) TaskHelper.exn_if_cancelling ~__context; () in - stream_from "") in - for_each_vdi __context (recv_one ifd __context) prefix_vdis; + stream_from ""; + Unixext.fsync ofd) in + begin try + for_each_vdi __context (recv_one ifd __context) prefix_vdis; + with Unix.Unix_error(Unix.EIO, _, _) -> + raise (Api_errors.Server_error (Api_errors.vdi_io_error, ["Device I/O error"])) + end; if !hdr <> None then begin error "Failed to import XVA; some chunks were not processed."; raise (Failure "Some XVA data not processed") _______________________________________________ xen-api mailing list xen-api@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/mailman/listinfo/xen-api
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |