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/
Home Products Support Community News


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

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH] CA-35407: Improve error message on VM.revert failure.
From: Thomas Gazagnaire <thomas.gazagnaire@xxxxxxxxxx>
Date: Fri, 11 Dec 2009 13:59:20 +0000
Delivery-date: Fri, 11 Dec 2009 05:59:29 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
# 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 
-               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;
                                 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 
                                         raise e;

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

xen-api mailing list
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-API] [PATCH] CA-35407: Improve error message on VM.revert failure., Thomas Gazagnaire <=