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

[Xen-API] [PATCH] CA-35407: Improve error message on VM.revert failure.



# HG changeset patch
# User Thomas Gazagnaire <thomas.gazagnaire@xxxxxxxxxx>
CA-35407: Improve error message on VM.revert failure.

On VM.revert, when the snapshot chain is too long to clone the snapshoted disks 
what we are reverting to, then propagate the SM backend error back to the user.

Signed-off-by: Thomas Gazagnaire <thomas.gazagnaire@xxxxxxxxxx>

diff -r d01d7d81f193 ocaml/xapi/xapi_vm_snapshot.ml
--- a/ocaml/xapi/xapi_vm_snapshot.ml    Fri Dec 11 13:44:40 2009 +0000
+++ b/ocaml/xapi/xapi_vm_snapshot.ml    Fri Dec 11 13:59:30 2009 +0000
@@ -379,7 +379,14 @@
        with e ->
                error "revert failed: %s" (Printexc.to_string e);
                Xapi_vm_lifecycle.force_state_reset ~__context ~self:vm 
~value:`Halted;
-               raise (Api_errors.Server_error (Api_errors.vm_revert_failed, 
[Ref.string_of snapshot; Ref.string_of vm]))
+               match e with
+               | Api_errors.Server_error("SR_BACKEND_FAILURE_44", _) as e ->
+                       error "Not enough space to create the new disk images";
+                       raise e
+               | Api_errors.Server_error("SR_BACKEND_FAILURE_109", _) as e ->
+                       error "Snapshot chain too long";
+                       raise e
+               | _ -> raise (Api_errors.Server_error 
(Api_errors.vm_revert_failed, [Ref.string_of snapshot; Ref.string_of vm]))
 
 let    create_vm_from_snapshot ~__context ~snapshot =
        let old_vm = Db.VM.get_snapshot_of ~__context ~self:snapshot in
@@ -402,7 +409,7 @@
                                         List.iter (fun (snap,_) -> 
Db.VM.set_snapshot_of ~__context ~self:snap ~value:new_vm) snapshots;
                                         new_vm
                                 with e ->
-                                        debug "cleanin-up by deleting the VM 
%s" (Ref.string_of new_vm);
+                                        debug "cleaning-up by deleting the VM 
%s" (Ref.string_of new_vm);
                                         Client.VM.destroy rpc session_id 
new_vm;
                                         raise e;
                                 end)

Attachment: xapi-propagate-snapshot-chain-too-long-error-on-revert
Description: Text document

_______________________________________________
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®.