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

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

 



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

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