Signed-off-by: Katerina Koukiou <kkoukiou(a)redhat.com>
---
data/org.libvirt.Domain.xml | 7 +++++++
src/domain.c | 27 +++++++++++++++++++++++++++
2 files changed, 34 insertions(+)
diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index a16a13f..901f84a 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -319,6 +319,13 @@
<arg name="password" type="s" direction="in"/>
<arg name="flags" type="u" direction="in"/>
</method>
+ <method name="SetTime">
+ <annotation name="org.gtk.GDBus.DocString"
+ value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetTime&quo...
+ <arg name="seconds" type="t" direction="in"/>
+ <arg name="nseconds" type="u" direction="in"/>
+ <arg name="flags" type="u" direction="in"/>
+ </method>
<method name="SetVcpus">
<annotation name="org.gtk.GDBus.DocString"
value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetVcpusFla...
diff --git a/src/domain.c b/src/domain.c
index e7ef054..d636328 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -1513,6 +1513,32 @@ virtDBusDomainSetUserPassword(GVariant *inArgs,
virtDBusUtilSetLastVirtError(error);
}
+static void
+virtDBusDomainSetTime(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;
+ gulong seconds;
+ guint nseconds;
+ guint flags;
+
+ g_variant_get(inArgs, "(tuu)", & seconds, &nseconds, &flags);
+
+ domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+ if (!domain)
+ return;
+
+ if (virDomainSetTime(domain, seconds, nseconds, flags) < 0)
+ virtDBusUtilSetLastVirtError(error);
+}
+
static void
virtDBusDomainSetVcpus(GVariant *inArgs,
GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -1687,6 +1713,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] = {
{ "SendProcessSignal", virtDBusDomainSendProcessSignal },
{ "SetVcpus", virtDBusDomainSetVcpus },
{ "SetMemory", virtDBusDomainSetMemory },
+ { "SetTime", virtDBusDomainSetTime },
{ "SetUserPassword", virtDBusDomainSetUserPassword },
{ "Shutdown", virtDBusDomainShutdown },
{ "Suspend", virtDBusDomainSuspend },
--
2.15.0