On 3/20/19 4:40 PM, John Ferlan wrote:
On 3/20/19 1:40 AM, Eric Blake wrote:
> Separate the algorithm for which list members to vist (which is
> generic and can be shared with checkpoints, provided that checkpoints
> pick the same bit values for some of its flags) from the decision on
> which members to return (which is specific to snapshots). The typedef
> for the callback function feels a bit heavy here, but will make it
> easier to move the common portions in a later patch.
>
> Signed-off-by: Eric Blake <eblake(a)redhat.com>
> ---
> src/conf/virdomainsnapshotobjlist.h | 4 ++
> src/conf/virdomainsnapshotobjlist.c | 60 ++++++++++++++++++-----------
> 2 files changed, 42 insertions(+), 22 deletions(-)
>
Reviewed-by: John Ferlan <jferlan(a)redhat.com>
I'm squashing in this code motion as well; missed in 9b75154c
(basically, the filter flags are a functionality of the listing, not of
the XML - made more obvious by this patch splitting out the filter
callback as the client of those macros).
diff --git i/src/conf/snapshot_conf.h w/src/conf/snapshot_conf.h
index b13a500af4..937310efac 100644
--- i/src/conf/snapshot_conf.h
+++ w/src/conf/snapshot_conf.h
@@ -133,29 +133,6 @@ int
virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr snapshot,
int default_snapshot,
bool require_match);
-# define VIR_DOMAIN_SNAPSHOT_FILTERS_METADATA \
- (VIR_DOMAIN_SNAPSHOT_LIST_METADATA | \
- VIR_DOMAIN_SNAPSHOT_LIST_NO_METADATA)
-
-# define VIR_DOMAIN_SNAPSHOT_FILTERS_LEAVES \
- (VIR_DOMAIN_SNAPSHOT_LIST_LEAVES | \
- VIR_DOMAIN_SNAPSHOT_LIST_NO_LEAVES)
-
-# define VIR_DOMAIN_SNAPSHOT_FILTERS_STATUS \
- (VIR_DOMAIN_SNAPSHOT_LIST_INACTIVE | \
- VIR_DOMAIN_SNAPSHOT_LIST_ACTIVE | \
- VIR_DOMAIN_SNAPSHOT_LIST_DISK_ONLY)
-
-# define VIR_DOMAIN_SNAPSHOT_FILTERS_LOCATION \
- (VIR_DOMAIN_SNAPSHOT_LIST_INTERNAL | \
- VIR_DOMAIN_SNAPSHOT_LIST_EXTERNAL)
-
-# define VIR_DOMAIN_SNAPSHOT_FILTERS_ALL \
- (VIR_DOMAIN_SNAPSHOT_FILTERS_METADATA | \
- VIR_DOMAIN_SNAPSHOT_FILTERS_LEAVES | \
- VIR_DOMAIN_SNAPSHOT_FILTERS_STATUS | \
- VIR_DOMAIN_SNAPSHOT_FILTERS_LOCATION)
-
bool virDomainSnapshotDefIsExternal(virDomainSnapshotDefPtr def);
bool virDomainSnapshotIsExternal(virDomainSnapshotObjPtr snap);
diff --git i/src/conf/virdomainsnapshotobjlist.h
w/src/conf/virdomainsnapshotobjlist.h
index c7d4d265cb..8975f1a8dd 100644
--- i/src/conf/virdomainsnapshotobjlist.h
+++ w/src/conf/virdomainsnapshotobjlist.h
@@ -74,6 +74,29 @@ int
virDomainSnapshotForEach(virDomainSnapshotObjListPtr snapshots,
void *data);
int virDomainSnapshotUpdateRelations(virDomainSnapshotObjListPtr
snapshots);
+# define VIR_DOMAIN_SNAPSHOT_FILTERS_METADATA \
+ (VIR_DOMAIN_SNAPSHOT_LIST_METADATA | \
+ VIR_DOMAIN_SNAPSHOT_LIST_NO_METADATA)
+
+# define VIR_DOMAIN_SNAPSHOT_FILTERS_LEAVES \
+ (VIR_DOMAIN_SNAPSHOT_LIST_LEAVES | \
+ VIR_DOMAIN_SNAPSHOT_LIST_NO_LEAVES)
+
+# define VIR_DOMAIN_SNAPSHOT_FILTERS_STATUS \
+ (VIR_DOMAIN_SNAPSHOT_LIST_INACTIVE | \
+ VIR_DOMAIN_SNAPSHOT_LIST_ACTIVE | \
+ VIR_DOMAIN_SNAPSHOT_LIST_DISK_ONLY)
+
+# define VIR_DOMAIN_SNAPSHOT_FILTERS_LOCATION \
+ (VIR_DOMAIN_SNAPSHOT_LIST_INTERNAL | \
+ VIR_DOMAIN_SNAPSHOT_LIST_EXTERNAL)
+
+# define VIR_DOMAIN_SNAPSHOT_FILTERS_ALL \
+ (VIR_DOMAIN_SNAPSHOT_FILTERS_METADATA | \
+ VIR_DOMAIN_SNAPSHOT_FILTERS_LEAVES | \
+ VIR_DOMAIN_SNAPSHOT_FILTERS_STATUS | \
+ VIR_DOMAIN_SNAPSHOT_FILTERS_LOCATION)
+
int virDomainListSnapshots(virDomainSnapshotObjListPtr snapshots,
virDomainSnapshotObjPtr from,
virDomainPtr dom,
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization:
qemu.org |
libvirt.org