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

Re: [libvirt] [PATCHv2 13/26] snapshot: identify qemu snapshot roots



On 08/15/2011 05:33 PM, Eric Blake wrote:
Filtering for roots is pretty easy to do.

@@ -11180,6 +11181,8 @@ static void virDomainSnapshotObjListCopyNames(void *payload,

      if (data->oom)
          return;
+    if ((data->flags&  VIR_DOMAIN_SNAPSHOT_LIST_ROOTS)&&  !obj->def->parent)
+        return;

Logic is backwards.  If obj has a parent, it is not a root.  Squash this in:

diff --git i/src/conf/domain_conf.c w/src/conf/domain_conf.c
index 4bf3541..d88ba5d 100644
--- i/src/conf/domain_conf.c
+++ w/src/conf/domain_conf.c
@@ -11181,7 +11181,7 @@ static void virDomainSnapshotObjListCopyNames(void *payload,

     if (data->oom)
         return;
- if ((data->flags & VIR_DOMAIN_SNAPSHOT_LIST_ROOTS) && !obj->def->parent)
+    if ((data->flags & VIR_DOMAIN_SNAPSHOT_LIST_ROOTS) && obj->def->parent)
         return;

     if (data->numnames < data->maxnames) {
@@ -11225,8 +11225,7 @@ static void virDomainSnapshotObjListCount(void *payload,
     virDomainSnapshotObjPtr obj = payload;
     struct virDomainSnapshotNumData *data = opaque;

-    if ((data->flags & VIR_DOMAIN_SNAPSHOT_LIST_ROOTS) &&
-        !obj->def->parent)
+    if ((data->flags & VIR_DOMAIN_SNAPSHOT_LIST_ROOTS) && obj->def->parent)
         return;
     data->count++;
 }

--
Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org


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