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] CA-35392: The snapshot parent links are not correctly

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH] CA-35392: The snapshot parent links are not correctly updated on upgrade.
From: Thomas Gazagnaire <thomas.gazagnaire@xxxxxxxxxx>
Date: Fri, 11 Dec 2009 13:33:11 +0000
Delivery-date: Fri, 11 Dec 2009 05:33:11 -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-35392: The snapshot parent links are not correctly updated on upgrade.

Also add some debugging information when the upgrade happens.

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

diff -r a9c9139575d3 ocaml/database/db_upgrade.ml
--- a/ocaml/database/db_upgrade.ml      Fri Dec 11 13:14:49 2009 +0000
+++ b/ocaml/database/db_upgrade.ml      Fri Dec 11 13:25:24 2009 +0000
@@ -216,19 +216,18 @@
        let update_snapshots vm_row =
                let vm = lookup_field_in_row vm_row Names.ref in
                let snapshot_rows = List.filter (fun s -> lookup_field_in_row s 
Names.snapshot_of = vm) vm_rows in
-               let snapshot_rows = List.filter (fun s -> lookup_field_in_row s 
Names.parent = Ref.string_of Ref.null) snapshot_rows in
                let compare s1 s2 =
                        let t1 = lookup_field_in_row s1 Names.snapshot_time in
                        let t2 = lookup_field_in_row s2 Names.snapshot_time in
                        compare t1 t2 in
                let ordered_snapshot_rows = List.sort compare snapshot_rows in
+               debug "Snapshots(%s) = {%s}" vm (String.concat ", " (List.map 
(fun s -> lookup_field_in_row s Names.ref) ordered_snapshot_rows));
                let rec aux = function
-                       | [] -> ()
-                       | [s] -> set_field_in_row s Names.parent vm;
+                       | [] | [_] -> ()
                        | s1 :: s2 :: t ->
                                set_field_in_row s2 Names.parent 
(lookup_field_in_row s1 Names.ref);
                                aux (s2 :: t) in
-               aux ordered_snapshot_rows in
+               aux (ordered_snapshot_rows @ [ vm_row]) in
        List.iter update_snapshots vm_rows
 
 (** A list of all the custom database upgrade rules known to the system. *)

Attachment: xapi-fix-snapshot-parents-on-upgrade
Description: Text document

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-API] [PATCH] CA-35392: The snapshot parent links are not correctly updated on upgrade., Thomas Gazagnaire <=