This commit also adds virDomainSnapshotListFlags which is used by various snapshot related methods. Signed-off-by: Wido den Hollander <wido@xxxxxxxxx> --- src/main/java/org/libvirt/Domain.java | 54 +++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/libvirt/Domain.java b/src/main/java/org/libvirt/Domain.java index 8f4d9da..da03c27 100644 --- a/src/main/java/org/libvirt/Domain.java +++ b/src/main/java/org/libvirt/Domain.java @@ -87,6 +87,40 @@ public class Domain { static final int SNAPSHOTS_METADATA = (1 << 1); } + static final class SnapshotListFlags { + /** + * Filter by snapshots with no parents, when listing a domain + */ + static final int ROOTS = (1 << 0); + + /** + * List all descendants, not just children, when listing a snapshot + */ + static final int DESCENDANTS = (1 << 0); + + /** For historical reasons, groups do not use contiguous bits. */ + + /** + * Filter by snapshots with no children + */ + static final int LEAVES = (1 << 2); + + /** + * Filter by snapshots that have children + */ + static final int NO_LEAVES = (1 << 3); + + /** + * Filter by snapshots which have metadata + */ + static final int METADATA = (1 << 1); + + /** + * Filter by snapshots with no metadata + */ + static final int NO_METADATA = (1 << 4); + } + /** * the native virDomainPtr. */ @@ -1050,7 +1084,7 @@ public class Domain { } /** - * Collect the list of domain snapshots for the given domain. + * Collect the list of domain snapshots for the given domain. With the option to pass flags * * @see <a * href="http://www.libvirt.org/html/libvirt-libvirt.html#virDomainSnapshotListNames">Libvirt @@ -1058,13 +1092,13 @@ public class Domain { * @return The list of names, or null if an error * @throws LibvirtException */ - public String[] snapshotListNames() throws LibvirtException { + public String[] snapshotListNames(int flags) throws LibvirtException { String[] returnValue = null; int num = snapshotNum(); if (num >= 0) { returnValue = new String[num]; if (num > 0) { - libvirt.virDomainSnapshotListNames(VDP, returnValue, num, 0); + libvirt.virDomainSnapshotListNames(VDP, returnValue, num, flags); processError(); } } @@ -1072,6 +1106,20 @@ public class Domain { } /** + * Collect the list of domain snapshots for the given domain. + * This method is here for backwards compatibility. + * + * @see <a + * href="http://www.libvirt.org/html/libvirt-libvirt.html#virDomainSnapshotListNames">Libvirt + * Documentation</a> + * @return The list of names, or null if an error + * @throws LibvirtException + */ + public String[] snapshotListNames() throws LibvirtException { + return snapshotListNames(0); + } + + /** * Retrieve a snapshot by name * * @see <a -- 1.7.9.5 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list