WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

[Xen-API] [PATCH 3 of 4] CA-38567: Catch I/O errors during ?raw_vdi_impo

To: Xen API <xen-api@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-API] [PATCH 3 of 4] CA-38567: Catch I/O errors during ?raw_vdi_import
From: Daniel Stodden <daniel.stodden@xxxxxxxxxx>
Date: Fri, 05 Mar 2010 23:20:58 -0000
Delivery-date: Fri, 05 Mar 2010 15:20:57 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1267831255@xxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1267831255@xxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.3.1
# 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