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 1 of 4] CA-38567: Catch I/O errors during VDI import

To: Xen API <xen-api@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-API] [PATCH 1 of 4] CA-38567: Catch I/O errors during VDI import
From: Daniel Stodden <daniel.stodden@xxxxxxxxxx>
Date: Fri, 05 Mar 2010 23:20:56 -0000
Delivery-date: Fri, 05 Mar 2010 15:22:15 -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 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