[libvirt-java] [PATCH 50/65] Implement Connect.getSysinfo

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

 



This wraps the virConnectGetSysinfo function available since libvirt
version 0.8.8.

Signed-off-by: Claudio Bley <cbley@xxxxxxxxxx>
---
 src/main/java/org/libvirt/Connect.java     |   21 +++++++++++++++++++++
 src/main/java/org/libvirt/jna/Libvirt.java |    1 +
 2 files changed, 22 insertions(+)

diff --git a/src/main/java/org/libvirt/Connect.java b/src/main/java/org/libvirt/Connect.java
index f597826..8659076 100644
--- a/src/main/java/org/libvirt/Connect.java
+++ b/src/main/java/org/libvirt/Connect.java
@@ -969,6 +969,27 @@ public class Connect {
     }
 
     /**
+     * Returns the XML description of the sysinfo details for the host
+     * on which the hypervisor is running.
+     * <p>
+     * This information is generally available only for hypervisors
+     * running with root privileges.
+     *
+     * @return sysinfo details in the same format as the {@code
+     *         <sysinfo>} element of a domain XML.
+     * @since 1.5.2
+     */
+    public String getSysinfo() throws LibvirtException {
+        Pointer p = processError(libvirt.virConnectGetSysinfo(this.VCP, 0));
+
+        try {
+            return Library.getString(p);
+        } finally {
+            Library.free(p);
+        }
+    }
+
+    /**
      * Gets the name of the Hypervisor software used.
      *
      * @return the name
diff --git a/src/main/java/org/libvirt/jna/Libvirt.java b/src/main/java/org/libvirt/jna/Libvirt.java
index e4b2cfb..3bd63e1 100644
--- a/src/main/java/org/libvirt/jna/Libvirt.java
+++ b/src/main/java/org/libvirt/jna/Libvirt.java
@@ -183,6 +183,7 @@ public interface Libvirt extends Library {
     Pointer virConnectGetHostname(ConnectionPointer virConnectPtr);
     int virConnectGetLibVersion(ConnectionPointer virConnectPtr, LongByReference libVer);
     int virConnectGetMaxVcpus(ConnectionPointer virConnectPtr, String type);
+    Pointer virConnectGetSysinfo(ConnectionPointer virConnectPtr, int flags);
     String virConnectGetType(ConnectionPointer virConnectPtr);
     String virConnectGetURI(ConnectionPointer virConnectPtr);
     int virConnectGetVersion(ConnectionPointer virConnectPtr, LongByReference hvVer);
-- 
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]