1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2025-12-15 08:23:48 +03:00

Implement virDomain{Get,Set}Time APIs

While the setter can be generated automatically, the getter is not.
However, it would be a lot easier if they both share the same logic:
a python dictionary to represent the time: dict['seconds'] to
represent seconds, and dict['nseconds'] to represent nanoseconds.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Michal Privoznik
2014-05-19 15:04:44 +02:00
parent c5bbd5bd9d
commit bcacc418a3
4 changed files with 111 additions and 1 deletions

View File

@@ -59,3 +59,16 @@
ret = libvirtmod.virDomainFSThaw(self._o, mountpoints, flags)
if ret == -1: raise libvirtError ('virDomainFSThaw() failed', dom=self)
return ret
def getTime(self, flags=0):
"""Extract information about guest time """
ret = libvirtmod.virDomainGetTime(self._o, flags)
if ret == -1: raise libvirtError ('virDomainGetTime() failed', dom=self)
return ret
def setTime(self, time=None, flags=0):
"""Set guest time to the given value. @time is a dict conatining
'seconds' field for seconds and 'nseconds' field for nanosecons """
ret = libvirtmod.virDomainSetTime(self._o, time, flags)
if ret == -1: raise libvirtError ('virDomainSetTime() failed', dom=self)
return ret