Re: [PATCH libvirt-java 9/9] Add resize flags to StorageVol

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

 



At Sat,  5 Jan 2013 12:48:26 +0100,
Wido den Hollander wrote:
> 
> 
> Signed-off-by: Wido den Hollander <wido@xxxxxxxxx>
> ---
>  src/main/java/org/libvirt/StorageVol.java |    7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/src/main/java/org/libvirt/StorageVol.java b/src/main/java/org/libvirt/StorageVol.java
> index 66e647f..9ea23c7 100644
> --- a/src/main/java/org/libvirt/StorageVol.java
> +++ b/src/main/java/org/libvirt/StorageVol.java
> @@ -23,6 +23,13 @@ public class StorageVol {
>          static final int VIR_STORAGE_POOL_DELETE_ZEROED = 1;
>      }
>  
> +    static final class ResizeFlags {
> +        /**
> +         * Size is in bytes instead of KiB
> +         */
> +        static final int VIR_DOMAIN_BLOCK_RESIZE_BYTES = (1 << 0);
> +    }
> +
>      public static enum Type {
>          /**

NACK. According to the libvirt API, virStorageVolResizeFlags has these
possible values:

VIR_STORAGE_VOL_RESIZE_ALLOCATE	 =	1	 : force allocation of new size
VIR_STORAGE_VOL_RESIZE_DELTA	 =	2	 : size is relative to current
VIR_STORAGE_VOL_RESIZE_SHRINK	 =	4	 : allow decrease in capacity

You probably want to move the stanza above into Domain.java. Please
rename the class when you do this to "BlockResizeFlags" to be
consistant with the naming in libvirt.

Additionally, consensus was that we should drop the C prefixes from
enum values when wrapping them in Java. I will do this for existing
enums when I find the time, but for new enums we could just as well
avoid introducing them in the first place.

In this case the prefix of VIR_DOMAIN_BLOCK_RESIZE should be
removed. Usage would thus be

Domain.BlockResizeFlags.BYTES

instead of the repetitious

Domain.BlockResizeFlags.VIR_DOMAIN_BLOCK_RESIZE_BYTES

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]