]> xenbits.xensource.com Git - libvirt.git/commitdiff
snapshot: sort snapshot-list --tree
authorEric Blake <eblake@redhat.com>
Fri, 7 Oct 2011 21:55:59 +0000 (15:55 -0600)
committerEric Blake <eblake@redhat.com>
Mon, 10 Oct 2011 17:12:43 +0000 (11:12 -0600)
Otherwise, the results are not repeatable.

* tools/virsh.c (cmdSnapshotList): Print tree in predictable order.

tools/virsh.c

index 9532bc303a03149388ade5c36f33ba14818eb60e..20b3dc5a61bfca606dc358bdb33b3adf1b40d365 100644 (file)
@@ -13209,6 +13209,8 @@ cmdSnapshotList(vshControl *ctl, const vshCmd *cmd)
     if (actual < 0)
         goto cleanup;
 
+    qsort(&names[0], actual, sizeof(char*), namesorter);
+
     if (tree) {
         char indentBuf[INDENT_BUFLEN];
         char **parents = vshMalloc(ctl, sizeof(char *) * actual);
@@ -13245,8 +13247,6 @@ cmdSnapshotList(vshControl *ctl, const vshCmd *cmd)
         ret = true;
         goto cleanup;
     } else {
-        qsort(&names[0], actual, sizeof(char*), namesorter);
-
         for (i = 0; i < actual; i++) {
             /* free up memory from previous iterations of the loop */
             VIR_FREE(parent);