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

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

 



At Sat,  5 Jan 2013 12:48:19 +0100,
Wido den Hollander wrote:
> 
> 
> Signed-off-by: Wido den Hollander <wido@xxxxxxxxx>
> ---
>  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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]