]> xenbits.xensource.com Git - xcp/xen-api.git/commitdiff
CA-38567: Catch I/O errors during VM.suspend
authorDaniel Stodden <daniel.stodden@citrix.com>
Mon, 15 Mar 2010 09:22:23 +0000 (09:22 +0000)
committerDaniel Stodden <daniel.stodden@citrix.com>
Mon, 15 Mar 2010 09:22:23 +0000 (09:22 +0000)
Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
ocaml/xapi/vmops.ml
ocaml/xapi/xapi_vm_snapshot.ml

index b72616291903c837b10880944cfea1b0e3071c55..801a59e849dfa2250a0041ca4d54b5b0f249927d 100644 (file)
@@ -950,7 +950,13 @@ let suspend ~live ~progress_cb ~__context ~xc ~xs ~vm =
                                                suspend_domain ~fd ~hvm ();
                                                (* If the suspend succeeds, set the suspend_VDI *)
                                                Db.VM.set_suspend_VDI ~__context ~self:vm ~value:vdi_ref;)
-                                       (fun () -> Unix.close fd);
+                                               (fun () ->
+                                                  try
+                                                    Unixext.fsync fd;
+                                                    Unix.close fd
+                                                  with Unix.Unix_error(Unix.EIO, _, _) ->
+                                                    raise (Api_errors.Server_error (Api_errors.vdi_io_error, ["I/O error saving VM suspend image"]))
+                                               );
                                debug "suspend: complete");
                debug "suspend phase 4/4: recording memory usage";
                (* Record the final memory usage of the VM, so that we know how much *)
index 9f0270632c1715a962c7ca71a507f55718158f8b..120b7cfe5d11a708bd0383c4c94321e7355f8633 100644 (file)
@@ -192,6 +192,7 @@ let checkpoint ~__context ~vm ~new_name =
                                | Api_errors.Server_error(code, _) as e when code = Api_errors.vm_no_suspend_sr ->
                                          error "No suspend SR available for this VM";
                                          raise e
+                               | Api_errors.Server_error(_, _) as e -> raise e
                                | _ -> raise (Api_errors.Server_error (Api_errors.vm_checkpoint_suspend_failed, [Ref.string_of vm]))
                end;