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

Re: [libvirt] [PATCH libvirt-java 2/9] Add resize method in StorageVol



At Sat,  5 Jan 2013 12:48:19 +0100,
Wido den Hollander wrote:
> 
> 
> Signed-off-by: Wido den Hollander <wido widodh nl>
> ---
>  src/main/java/org/libvirt/StorageVol.java |   19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/src/main/java/org/libvirt/StorageVol.java b/src/main/java/org/libvirt/StorageVol.java
> index 1bed6e1..66e647f 100644
> --- a/src/main/java/org/libvirt/StorageVol.java
> +++ b/src/main/java/org/libvirt/StorageVol.java
> @@ -4,6 +4,8 @@ import org.libvirt.jna.Libvirt;
>  import org.libvirt.jna.StoragePoolPointer;
>  import org.libvirt.jna.StorageVolPointer;
>  import org.libvirt.jna.virStorageVolInfo;
> +import com.sun.jna.Native;

This import is unused.

> +import com.sun.jna.NativeLong;
>  
>  /**
>   * An acutal storage bucket.
> @@ -208,4 +210,21 @@ public class StorageVol {
>          processError();
>          return returnValue;
>      }
> +
> +    /**
> +     * Resize a volume
> +     *
> +     * @see <a href="http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolResize";>Libvirt Documentation</a>
> +     * @param capacity
> +     *            new capacity for volume
> +     * @param flags
> +     *            flags for resizing, see libvirt API for exact flags
> +     * @return 0 on success, or -1 on error
> +     * @throws LibvirtException
> +     */
> +    public int resize(NativeLong capacity, int flags) throws LibvirtException {
> +        int returnValue = libvirt.virStorageVolResize(VSVP, capacity, flags);
> +        processError();
> +        return returnValue;
> +    }

JNA types should not be exposed to the public API, IMHO. So, using
NativeLong in the parameter list is not good.

And see my comment for 1/9.

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


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