[dbus PATCH 04/10] Implement NodeGetInfo method for Connect Interface

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

 



Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx>
---
 data/org.libvirt.Connect.xml |  5 +++++
 src/connect.c                | 25 +++++++++++++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml
index f0a7738..2e65f8b 100644
--- a/data/org.libvirt.Connect.xml
+++ b/data/org.libvirt.Connect.xml
@@ -185,6 +185,11 @@
         value="See https://libvirt.org/html/libvirt-libvirt-host.html#virNodeGetFreeMemory"/>
       <arg name="freemem" type="t" direction="out"/>
     </method>
+    <method name="NodeGetInfo">
+      <annotation name="org.gtk.GDBus.DocString"
+        value="See https://libvirt.org/html/libvirt-libvirt-host.html#virNodeGetInfo"/>
+      <arg name="info" type="(stuuuuuu)" direction="out"/>
+    </method>
     <signal name="DomainEvent">
       <annotation name="org.gtk.GDBus.DocString"
         value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectDomainEventCallback"/>
diff --git a/src/connect.c b/src/connect.c
index 60fcaa5..bb9bd46 100644
--- a/src/connect.c
+++ b/src/connect.c
@@ -944,6 +944,30 @@ virtDBusConnectNodeGetFreeMemory(GVariant *inArgs G_GNUC_UNUSED,
     *outArgs = g_variant_new("(t)", freemem);
 }
 
+static void
+virtDBusConnectNodeGetInfo(GVariant *inArgs G_GNUC_UNUSED,
+                           GUnixFDList *inFDs G_GNUC_UNUSED,
+                           const gchar *objectPath G_GNUC_UNUSED,
+                           gpointer userData,
+                           GVariant **outArgs,
+                           GUnixFDList **outFDs G_GNUC_UNUSED,
+                           GError **error)
+
+{
+    virtDBusConnect *connect = userData;
+    virNodeInfo info;
+
+    if (!virtDBusConnectOpen(connect, error))
+        return;
+
+    if (virNodeGetInfo(connect->connection, &info) < 0)
+        return virtDBusUtilSetLastVirtError(error);
+
+    *outArgs = g_variant_new("((stuuuuuu))", info.model, info.memory,
+                             info.cpus, info.mhz, info.nodes, info.sockets,
+                             info.cores, info.threads);
+}
+
 static virtDBusGDBusPropertyTable virtDBusConnectPropertyTable[] = {
     { "Encrypted", virtDBusConnectGetEncrypted, NULL },
     { "Hostname", virtDBusConnectGetHostname, NULL },
@@ -978,6 +1002,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethodTable[] = {
     { "NodeGetCellsFreeMemory", virtDBusConnectNodeGetCellsFreeMemory },
     { "NodeGetCPUStats", virtDBusConnectNodeGetCPUStats },
     { "NodeGetFreeMemory", virtDBusConnectNodeGetFreeMemory },
+    { "NodeGetInfo", virtDBusConnectNodeGetInfo },
     { 0 }
 };
 
-- 
2.15.0

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

  Powered by Linux