[libvirt] [PATCH libvirt-java 5/7] Overload Domain.snapshotCreateXML with a method that has a argument for flags

Wido den Hollander wido at widodh.nl
Sun Jan 13 18:09:27 UTC 2013


The original implementation doesn't have a argument for passing flags. It is
however still there for backwards compatibility.

Signed-off-by: Wido den Hollander <wido at widodh.nl>
---
 src/main/java/org/libvirt/Domain.java |   24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/libvirt/Domain.java b/src/main/java/org/libvirt/Domain.java
index da03c27..6bdc1df 100644
--- a/src/main/java/org/libvirt/Domain.java
+++ b/src/main/java/org/libvirt/Domain.java
@@ -1051,11 +1051,13 @@ public class Domain {
      *      Documentation</a>
      * @param xmlDesc
      *            string containing an XML description of the domain
+     * @param flags
+     *            flags for creating the snapshot, see the virDomainSnapshotCreateFlags for the flag options
      * @return the snapshot, or null on Error
      * @throws LibvirtException
      */
-    public DomainSnapshot snapshotCreateXML(String xmlDesc) throws LibvirtException {
-        DomainSnapshotPointer ptr = libvirt.virDomainSnapshotCreateXML(VDP, xmlDesc, 0);
+    public DomainSnapshot snapshotCreateXML(String xmlDesc, int flags) throws LibvirtException {
+        DomainSnapshotPointer ptr = libvirt.virDomainSnapshotCreateXML(VDP, xmlDesc, flags);
         processError();
         DomainSnapshot returnValue = null;
         if (ptr != null) {
@@ -1065,6 +1067,24 @@ public class Domain {
     }
 
     /**
+     * Creates a new snapshot of a domain based on the snapshot xml contained in
+     * xmlDesc.
+     *
+     * This method is still here for backwards compatibility since the C version
+     * has an additional argument with flags, which is set to 0 here.
+     * @see <a
+     *      href="http://www.libvirt.org/html/libvirt-libvirt.html#virDomainSnapshotCreateXML">Libvirt
+     *      Documentation</a>
+     * @param xmlDesc
+     *            string containing an XML description of the domain
+     * @return the snapshot, or null on Error
+     * @throws LibvirtException
+     */
+    public DomainSnapshot snapshotCreateXML(String xmlDesc) throws LibvirtException {
+        return snapshotCreateXML(xmlDesc, 0);
+    }
+
+    /**
      * Get the current snapshot for a domain, if any.
      *
      * @see <a
-- 
1.7.9.5




More information about the libvir-list mailing list