Re: [PATCH libvirt-java 1/7] Implement virDomainBlockResize

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

 



At Sun, 13 Jan 2013 19:09:23 +0100,
Wido den Hollander wrote:
> 
> This adds the blockResize() method to the Domain class
> 
> Signed-off-by: Wido den Hollander <wido@xxxxxxxxx>
> ---
>  src/main/java/org/libvirt/Domain.java      |   17 +++++++++++++++++
>  src/main/java/org/libvirt/jna/Libvirt.java |    1 +
>  2 files changed, 18 insertions(+)
> 
> diff --git a/src/main/java/org/libvirt/Domain.java b/src/main/java/org/libvirt/Domain.java
> index 1c86bd4..3da6f56 100644
> --- a/src/main/java/org/libvirt/Domain.java
> +++ b/src/main/java/org/libvirt/Domain.java
> @@ -188,6 +188,23 @@ public class Domain {
>      }
>  
>      /**
> +     * Resize a block device of domain while the domain is running.
> +     *
> +     * @param disk
> +     *           path to the block image, or shorthand (like vda)
> +     * @param size
> +     *           the new size of the block devices
> +     * @param flags
> +     *           when set to 1, units of size is in bytes instead
> of KiloBytes

Um, I don't like using magic numbers. Apparently
Domain.BlockResizeFlags is missing.

ACK with this squashed in:

--- >8 ----
diff --git a/src/main/java/org/libvirt/Domain.java b/src/main/java/org/libvirt/Domain.java
index 3da6f56..aada6a9 100644
--- a/src/main/java/org/libvirt/Domain.java
+++ b/src/main/java/org/libvirt/Domain.java
@@ -24,6 +24,13 @@ import com.sun.jna.ptr.PointerByReference;
  */
 public class Domain {

+    public static final class BlockResizeFlags {
+        /**
+         * size is in bytes instead of KiB
+         */
+        public static final int BYTES = 1;
+    }
+
     static final class CreateFlags {
         static final int VIR_DOMAIN_NONE = 0;
         static final int VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE    = (1 << 0); /* Restore or alter
@@ -195,7 +202,7 @@ public class Domain {
      * @param size
      *           the new size of the block devices
      * @param flags
-     *           when set to 1, units of size is in bytes instead of KiloBytes
+     *           bitwise OR'ed values of {@link BlockResizeFlags}
      * @throws LibvirtException
      */
     public void blockResize(String disk, long size, int flags) throws LibvirtException {

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