On Thu, Feb 13, 2014 at 07:51:42PM +0100, Michal Privoznik wrote:
These APIs allow users to get or set time in a domain, which may
come
handy if the domain has been resumed just recently and NTP is not
configured or hasn't kicked in yet and the guest is running
something time critical. In addition, NTP may refuse to re-set the clock
if the skew is too big.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
include/libvirt/libvirt.h.in | 13 +++++++
src/driver.h | 13 +++++++
src/libvirt.c | 91 ++++++++++++++++++++++++++++++++++++++++++++
src/libvirt_public.syms | 6 +++
4 files changed, 123 insertions(+)
[...]
diff --git a/src/libvirt.c b/src/libvirt.c
index 666ab1e..aa063fd 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -20547,3 +20547,94 @@ error:
virDispatchError(dom->conn);
return -1;
}
+
+
+/**
+ * virDomainGetTime:
+ * @dom: a domain object
+ * @time: where to store the domain's time
+ * @flags: extra flags, not used yet, so callers should always pass 0
+ *
+ * Get the information about guest time relative to the Epoch of
+ * 1970-01-01 in UTC. The returned time is in seconds.
+ *
+ * Please note that some hypoervisors may require guest agent to
+ * be configured and running in order to be able to run this API.
+ *
+ * Returns 0 on success, -1 otherwise.
+ */
+int
+virDomainGetTime(virDomainPtr dom,
+ long long *time,
+ unsigned int flags)
+{
+ VIR_DOMAIN_DEBUG(dom, "time=%p, flags=%x",
+ time, flags);
+
+ virResetLastError();
+
+ virCheckDomainReturn(dom, -1);
+ virCheckReadOnlyGoto(dom->conn->flags, error);
Can you add virCheckNonNullArgGoto(time, error); here? Or doesn't it
make sense? I haven't got to other patches, yet.
Preliminary ACK.
Martin