[dbus PATCH 01/15] Implement GetTime 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                | 28 ++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index a57b05a..631dabb 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -201,6 +201,12 @@
       <arg name="flags" type="u" direction="in"/>
       <arg name="records" type="a{sv}" direction="out"/>
     </method>
+    <method name="GetTime">
+      <annotation name="org.gtk.GDBus.DocString"
+        value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetTime"/>
+      <arg name="flags" type="u" direction="in"/>
+      <arg name="time" type="(tu)" direction="out"/>
+    </method>
     <method name="GetVcpus">
       <annotation name="org.gtk.GDBus.DocString"
         value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetVcpusFlags"/>
diff --git a/src/domain.c b/src/domain.c
index 488760b..f6de3ac 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -1054,6 +1054,33 @@ virtDBusDomainGetStats(GVariant *inArgs,
     *outArgs = g_variant_new_tuple(&grecords, 1);
 }
 
+static void
+virtDBusDomainGetTime(GVariant *inArgs,
+                      GUnixFDList *inFDs G_GNUC_UNUSED,
+                      const gchar *objectPath,
+                      gpointer userData,
+                      GVariant **outArgs,
+                      GUnixFDList **outFDs G_GNUC_UNUSED,
+                      GError **error)
+{
+    virtDBusConnect *connect = userData;
+    g_autoptr(virDomain) domain = NULL;
+    glong seconds;
+    guint nseconds;
+    guint flags;
+
+    g_variant_get(inArgs, "(u)", &flags);
+
+    domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+    if (!domain)
+        return;
+
+    if (virDomainGetTime(domain, (long long *)&seconds, &nseconds, flags) < 0)
+        return virtDBusUtilSetLastVirtError(error);
+
+    *outArgs = g_variant_new("((tu))", seconds, nseconds);
+}
+
 static void
 virtDBusDomainGetVcpus(GVariant *inArgs,
                        GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -1935,6 +1962,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] = {
     { "GetMemoryParameters", virtDBusDomainGetMemoryParameters },
     { "GetSchedulerParameters", virtDBusDomainGetSchedulerParameters },
     { "GetStats", virtDBusDomainGetStats },
+    { "GetTime", virtDBusDomainGetTime },
     { "GetVcpus", virtDBusDomainGetVcpus },
     { "GetXMLDesc", virtDBusDomainGetXMLDesc },
     { "HasManagedSaveImage", virtDBusDomainHasManagedSaveImage },
-- 
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