[PATCH libvirt-java 1/7] Implement virDomainBlockResize

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

 



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
+     * @throws LibvirtException
+     */
+    public void blockResize(String disk, long size, int flags) throws LibvirtException {
+        int returnValue = libvirt.virDomainBlockResize(VDP, disk, size, flags);
+        processError();
+    }
+
+
+    /**
      * Dumps the core of this domain on a given file for analysis. Note that for
      * remote Xen Daemon the file path will be interpreted in the remote host.
      *
diff --git a/src/main/java/org/libvirt/jna/Libvirt.java b/src/main/java/org/libvirt/jna/Libvirt.java
index 87979cd..e64cb9d 100644
--- a/src/main/java/org/libvirt/jna/Libvirt.java
+++ b/src/main/java/org/libvirt/jna/Libvirt.java
@@ -181,6 +181,7 @@ public interface Libvirt extends Library {
     int virDomainAttachDevice(DomainPointer virDomainPtr, String deviceXML);
     int virDomainAttachDeviceFlags(DomainPointer virDomainPtr, String deviceXML, int flags);
     int virDomainBlockStats(DomainPointer virDomainPtr, String path, virDomainBlockStats stats, int size);
+    int virDomainBlockResize(DomainPointer virDomainPtr, String disk, long size, int flags);
     int virDomainCoreDump(DomainPointer virDomainPtr, String to, int flags);
     int virDomainCreate(DomainPointer virDomainPtr);
     int virDomainCreateWithFlags(DomainPointer virDomainPtr, int flags);
-- 
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]