[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-API] [PATCH 2 of 4] CA-38567: Catch I/O errors during VDI.copy



# HG changeset patch
# User Daniel Stodden <daniel.stodden@xxxxxxxxxx>
# Date 1267831159 28800
# Node ID 19f971d3238714940e6ada4acf23a7ee7cb9558f
# Parent  04f7f3dde50d56896814e9568e7c3d43d8d9bde7
CA-38567: Catch I/O errors during VDI.copy.

Signed-off-by: Daniel Stodden <daniel.stodden@xxxxxxxxxx>

diff -r 04f7f3dde50d -r 19f971d32387 ocaml/xapi/sm_fs_ops.ml
--- a/ocaml/xapi/sm_fs_ops.ml   Fri Mar 05 15:19:18 2010 -0800
+++ b/ocaml/xapi/sm_fs_ops.ml   Fri Mar 05 15:19:19 2010 -0800
@@ -244,17 +244,20 @@
        with_block_attached_device __context rpc session_id vdi_dst `RW
         (fun device_dst ->
            let ifd=Unix.openfile device_src [Unix.O_RDONLY] 0o600 
-           and ofd=Unix.openfile device_dst [Unix.O_WRONLY] 0o600 in
-           try
-             dd ifd ofd size blocksize;
-             Unix.close ifd;
-             Unix.close ofd
-           with
-             e ->
-               debug "Caught exception %s" (ExnHelper.string_of_exn e);
-               log_backtrace ();
-               Unix.close ifd;
-               Unix.close ofd
+           and ofd=Unix.openfile device_dst [Unix.O_WRONLY; Unix.O_SYNC] 0o600 
in
+           finally
+             (fun () ->
+                try
+                  dd ifd ofd size blocksize;
+                with
+                  | Unix.Unix_error(Unix.EIO, _, _) ->
+                      raise (Api_errors.Server_error (Api_errors.vdi_io_error, 
["Device I/O error"]))
+                  | e ->
+                      debug "Caught exception %s" (ExnHelper.string_of_exn e);
+                      log_backtrace ())
+             (fun () ->
+                Unix.close ifd;
+                Unix.close ofd)
         )
     )
   )
# HG changeset patch
# User Daniel Stodden <daniel.stodden@xxxxxxxxxx>
# Date 1267831159 28800
# Node ID 19f971d3238714940e6ada4acf23a7ee7cb9558f
# Parent  04f7f3dde50d56896814e9568e7c3d43d8d9bde7
CA-38567: Catch I/O errors during VDI.copy.

Signed-off-by: Daniel Stodden <daniel.stodden@xxxxxxxxxx>

diff -r 04f7f3dde50d -r 19f971d32387 ocaml/xapi/sm_fs_ops.ml
--- a/ocaml/xapi/sm_fs_ops.ml   Fri Mar 05 15:19:18 2010 -0800
+++ b/ocaml/xapi/sm_fs_ops.ml   Fri Mar 05 15:19:19 2010 -0800
@@ -244,17 +244,20 @@
        with_block_attached_device __context rpc session_id vdi_dst `RW
         (fun device_dst ->
            let ifd=Unix.openfile device_src [Unix.O_RDONLY] 0o600 
-           and ofd=Unix.openfile device_dst [Unix.O_WRONLY] 0o600 in
-           try
-             dd ifd ofd size blocksize;
-             Unix.close ifd;
-             Unix.close ofd
-           with
-             e ->
-               debug "Caught exception %s" (ExnHelper.string_of_exn e);
-               log_backtrace ();
-               Unix.close ifd;
-               Unix.close ofd
+           and ofd=Unix.openfile device_dst [Unix.O_WRONLY; Unix.O_SYNC] 0o600 
in
+           finally
+             (fun () ->
+                try
+                  dd ifd ofd size blocksize;
+                with
+                  | Unix.Unix_error(Unix.EIO, _, _) ->
+                      raise (Api_errors.Server_error (Api_errors.vdi_io_error, 
["Device I/O error"]))
+                  | e ->
+                      debug "Caught exception %s" (ExnHelper.string_of_exn e);
+                      log_backtrace ())
+             (fun () ->
+                Unix.close ifd;
+                Unix.close ofd)
         )
     )
   )
_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.