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

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



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;
+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;
+    }
 }
-- 
1.7.9.5


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