[dbus PATCH 16/25] Implement FSTrim 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 |  7 +++++++
 src/domain.c                | 28 ++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)

diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index 367bc00..6d4ffa5 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -149,6 +149,13 @@
       <arg name="flags" type="u" direction="in"/>
       <arg name="thawdFilesystems" type="u" direction="out"/>
     </method>
+    <method name="FSTrim">
+      <annotation name="org.gtk.GDBus.DocString"
+        value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainFSTrim"/>
+      <arg name="mountpoint" type="s" direction="in"/>
+      <arg name="minimum" type="t" direction="in"/>
+      <arg name="flags" type="u" direction="in"/>
+    </method>
     <method name="GetBlkioParameters">
       <annotation name="org.gtk.GDBus.DocString"
         value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetBlkioParameters"/>
diff --git a/src/domain.c b/src/domain.c
index a0feea9..f0e7f28 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -771,6 +771,33 @@ virtDBusDomainFSThaw(GVariant *inArgs,
     *outArgs = g_variant_new("(u)", ret);
 }
 
+static void
+virtDBusDomainFSTrim(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;
+    const gchar *mountpoint;
+    gulong minimum;
+    guint flags;
+
+    g_variant_get(inArgs, "(stu)", &mountpoint, &minimum, &flags);
+    if (g_strcmp0(mountpoint, "") == 0)
+        mountpoint = NULL;
+
+    domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+    if (!domain)
+        return;
+
+    if (virDomainFSTrim(domain, mountpoint, minimum, flags) < 0)
+        virtDBusUtilSetLastVirtError(error);
+}
+
 static void
 virtDBusDomainGetBlkioParameters(GVariant *inArgs,
                                  GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -1572,6 +1599,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] = {
     { "DetachDevice", virtDBusDomainDetachDevice },
     { "FSFreeze", virtDBusDomainFSFreeze },
     { "FSThaw", virtDBusDomainFSThaw },
+    { "FSTrim", virtDBusDomainFSTrim },
     { "GetBlkioParameters", virtDBusDomainGetBlkioParameters },
     { "GetControlInfo", virtDBusDomainGetControlInfo },
     { "GetJobInfo", virtDBusDomainGetJobInfo },
-- 
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