[dbus PATCH 4/6] Implement SetMemoryParameters method for Domain Interface

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

 



Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx>
---
 data/org.libvirt.Domain.xml |  6 ++++++
 src/domain.c                | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+)

diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index 7bbe520..61ac52e 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -435,6 +435,12 @@
       <arg name="memory" type="t" direction="in"/>
       <arg name="flags" type="u" direction="in"/>
     </method>
+    <method name="SetMemoryParameters">
+      <annotation name="org.gtk.GDBus.DocString"
+        value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetMemoryParameters"/>
+      <arg name="params" type="a{sv}" direction="in"/>
+      <arg name="flags" type="u" direction="in"/>
+    </method>
     <method name="SetMemoryStatsPeriod">
       <annotation name="org.gtk.GDBus.DocString"
         value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetMemoryStatsPeriod"/>
diff --git a/src/domain.c b/src/domain.c
index fb8db94..0202a92 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -2250,6 +2250,38 @@ virtDBusDomainSetMemory(GVariant *inArgs,
         virtDBusUtilSetLastVirtError(error);
 }
 
+static void
+virtDBusDomainSetMemoryParameters(GVariant *inArgs,
+                                  GUnixFDList *inFDs G_GNUC_UNUSED,
+                                  const gchar *objectPath,
+                                  gpointer userData,
+                                  GVariant **outArgs G_GNUC_UNUSED,
+                                  GUnixFDList **outFDs G_GNUC_UNUSED,
+                                  GError **error)
+{
+    virtDBusConnect *connect = userData;
+    g_autoptr(virDomain) domain = NULL;
+    g_autoptr(GVariantIter) iter = NULL;
+    g_auto(virtDBusUtilTypedParams) params = { 0 };
+    guint flags;
+
+    g_variant_get(inArgs, "(a{sv}u)", &iter, &flags);
+
+    if (!virtDBusUtilGVariantToTypedParams(iter, &params.params,
+                                           &params.nparams, error)) {
+        return;
+    }
+
+    domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+    if (!domain)
+        return;
+
+    if (virDomainSetMemoryParameters(domain, params.params,
+                                     params.nparams, flags) < 0) {
+        virtDBusUtilSetLastVirtError(error);
+    }
+}
+
 static void
 virtDBusDomainSetMemoryStatsPeriod(GVariant *inArgs,
                                    GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -2591,6 +2623,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] = {
     { "SetInterfaceParameters", virtDBusDomainSetInterfaceParameters },
     { "SetVcpus", virtDBusDomainSetVcpus },
     { "SetMemory", virtDBusDomainSetMemory },
+    { "SetMemoryParameters", virtDBusDomainSetMemoryParameters },
     { "SetMemoryStatsPeriod", virtDBusDomainSetMemoryStatsPeriod },
     { "SetMetadata", virtDBusDomainSetMetadata },
     { "SetPerfEvents", virtDBusDomainSetPerfEvents },
-- 
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