[libvirt] [dbus PATCH 08/10] Implement NodeSetMemoryParameters method for Connect Interface

Katerina Koukiou kkoukiou at redhat.com
Thu Apr 26 14:54:15 UTC 2018


Signed-off-by: Katerina Koukiou <kkoukiou at redhat.com>
---
 data/org.libvirt.Connect.xml |  6 ++++++
 src/connect.c                | 31 +++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)

diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml
index fc306be..a929802 100644
--- a/data/org.libvirt.Connect.xml
+++ b/data/org.libvirt.Connect.xml
@@ -209,6 +209,12 @@
       <arg name="flags" type="u" direction="in"/>
       <arg name="secModel" type="(ss)" direction="out"/>
     </method>
+    <method name="NodeSetMemoryParameters">
+      <annotation name="org.gtk.GDBus.DocString"
+        value="See https://libvirt.org/html/libvirt-libvirt-host.html#virNodeSetMemoryParameters"/>
+      <arg name="params" type="a{sv}" direction="in"/>
+      <arg name="flags" type="u" direction="in"/>
+    </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 32aa07d..3b7d8a3 100644
--- a/src/connect.c
+++ b/src/connect.c
@@ -1066,6 +1066,36 @@ virtDBusConnectNodeGetSecurityModel(GVariant *inArgs G_GNUC_UNUSED,
     *outArgs = g_variant_new("((ss))", secmodel.model, secmodel.doi);
 }
 
+static void
+virtDBusConnectNodeSetMemoryParameters(GVariant *inArgs,
+                                       GUnixFDList *inFDs G_GNUC_UNUSED,
+                                       const gchar *objectPath G_GNUC_UNUSED,
+                                       gpointer userData,
+                                       GVariant **outArgs G_GNUC_UNUSED,
+                                       GUnixFDList **outFDs G_GNUC_UNUSED,
+                                       GError **error)
+{
+    virtDBusConnect *connect = userData;
+    g_autoptr(GVariantIter) iter = NULL;
+    g_auto(virtDBusUtilTypedParams) params = { 0 };
+    guint flags;
+
+    g_variant_get(inArgs, "(a{sv}u)", &iter, &flags);
+
+    if (!virtDBusConnectOpen(connect, error))
+        return;
+
+    if (!virtDBusUtilGVariantToTypedParams(iter, &params.params,
+                                           &params.nparams, error)) {
+        return;
+    }
+
+    if (virNodeSetMemoryParameters(connect->connection, params.params,
+                                   params.nparams, flags) < 0) {
+        virtDBusUtilSetLastVirtError(error);
+    }
+}
+
 static virtDBusGDBusPropertyTable virtDBusConnectPropertyTable[] = {
     { "Encrypted", virtDBusConnectGetEncrypted, NULL },
     { "Hostname", virtDBusConnectGetHostname, NULL },
@@ -1104,6 +1134,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethodTable[] = {
     { "NodeGetMemoryParameters", virtDBusConnectNodeGetMemoryParameters },
     { "NodeGetMemoryStats", virtDBusConnectNodeGetMemoryStats },
     { "NodeGetSecurityModel", virtDBusConnectNodeGetSecurityModel },
+    { "NodeSetMemoryParameters", virtDBusConnectNodeSetMemoryParameters },
     { 0 }
 };
 
-- 
2.15.0




More information about the libvir-list mailing list