Re: [PATCHv2 09/13] list: use the new snapshot API in virsh when possible

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

 



On 06/15/12 06:18, Eric Blake wrote:
Using the new API is so much shorter than the rest of the remainder
of the function.

* tools/virsh.c (vshSnapshotList): Use the new API.
---

v2: fixes needed to pass testing

  tools/virsh.c |   31 ++++++++++++++++++++++++++++++-
  1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index 3e1018e..13b1c01 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -17002,13 +17002,42 @@ vshSnapshotListCollect(vshControl *ctl, virDomainPtr dom,
+    if (count >= 0) {
+        /* When mixing --from and --tree, we also want a copy of from
+         * in the list, but with no parent for that one entry.  */
+        snaplist->snaps = vshCalloc(ctl, sizeof(*snaplist->snaps),
+                                    count + (tree && from));

A little bit awkward on the first read, but correct.

+        snaplist->nsnaps = count;
+        for (i = 0; i < count; i++)
+            snaplist->snaps[i].snap = snaps[i];
+        VIR_FREE(snaps);


ACK.

Peter

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]