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

Claudio Bley cbley at av-test.de
Wed Jan 23 14:48:18 UTC 2013


At Sun, 13 Jan 2013 19:09:27 +0100,
Wido den Hollander wrote:
> 
> The original implementation doesn't have a argument for passing flags. It is
> however still there for backwards compatibility.

s/a argument/an argument/ in this sentence and in the subject.

> 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.

IMO, talking about backwards compatibility and C implementation details
here has no value to the average libvirt-java user. See my comment for
4/7, also.

ACK with the typo fixed and this squashed in:

--- >8 ----
diff --git a/src/main/java/org/libvirt/Domain.java b/src/main/java/org/libvirt/Domain.java
index f80e0e7..52aafb3 100644
--- a/src/main/java/org/libvirt/Domain.java
+++ b/src/main/java/org/libvirt/Domain.java
@@ -1076,9 +1076,11 @@ public class Domain {
     /**
      * Creates a new snapshot of a domain based on the snapshot xml contained in
      * xmlDesc.
+     * <p>
+     * This is just a convenience method, it has the same effect
+     * as calling {@code snapshotCreateXML(xmlDesc, 0);}.
      *
-     * 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 #snapshotCreateXML(int)
      * @see <a
      *      href="http://www.libvirt.org/html/libvirt-libvirt.html#virDomainSnapshotCreateXML">Libvirt
      *      Documentation</a>

-- 
AV-Test GmbH, Henricistraße 20, 04155 Leipzig, Germany
Phone: +49 341 265 310 19
Web:<http://www.av-test.org>

Eingetragen am / Registered at: Amtsgericht Stendal (HRB 114076)
Geschaeftsfuehrer (CEO): Andreas Marx, Guido Habicht, Maik Morgenstern




More information about the libvir-list mailing list