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

Claudio Bley cbley at av-test.de
Mon Jan 7 11:38:16 UTC 2013


At Sat,  5 Jan 2013 12:48:26 +0100,
Wido den Hollander wrote:
> 
> 
> Signed-off-by: Wido den Hollander <wido at widodh.nl>
> ---
>  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




More information about the libvir-list mailing list